Top Description Fields Constructors Methods
org.apache.pdfbox.tools

public final Class PDFToImage

extends Object
implements Callable<Integer>
Class Inheritance
All Implemented Interfaces
java.util.concurrent.Callable
Annotations
@Command
name:pdftoimage
header:Converts a PDF document to image(s)
versionProvider:Version
mixinStandardHelpOptions:true
Imports
java.awt.HeadlessException, .Toolkit, java.awt.image.BufferedImage, java.io.File, .IOException, .PrintStream, java.util.Arrays, .List, java.util.concurrent.Callable, java.util.stream.Collectors, javax.imageio.ImageIO, org.apache.commons.io.FilenameUtils, org.apache.pdfbox.Loader, org.apache.pdfbox.pdmodel.PDDocument, .PDPage, org.apache.pdfbox.pdmodel.common.PDRectangle, org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm, org.apache.pdfbox.rendering.ImageType, .PDFRenderer, org.apache.pdfbox.tools.imageio.ImageIOUtil, picocli.CommandLine, .CommandLine.Command, .CommandLine.Option

Convert a PDF document to an image.
Author
Ben Litchfield

Field Summary

Modifier and TypeField and Description
private int[]
private int
private int
private String
private ImageType
private File
private String
private int
private String
private float
private boolean
private int
private boolean
private final PrintStream

Constructor Summary

AccessConstructor and Description
public
PDFToImage()

Constructor.

Method Summary

Modifier and TypeMethod and Description
public Integer
call()

Implements java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

private static void
changeCropBox(PDDocument document, float a, float b, float c, float d)

public static void
main(String[]
Command line arguments, should be one and a reference to a file.
args
)

Infamous main method.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cropboxback to summary
private int[] cropbox
Annotations
@Option
names:-cropbox
arity:4
description:the page area to export
dpiback to summary
private int dpi
Annotations
@Option
names:-dpi, -resolution
description:the DPI of the output image, default: screen resolution or 96 if unknown
endPageback to summary
private int endPage
Annotations
@Option
names:-endPage
description:the last page to extract (inclusive)
imageFormatback to summary
private String imageFormat
Annotations
@Option
names:-format
description:the image file format (default: ${DEFAULT-VALUE})
imageTypeback to summary
private ImageType imageType
Annotations
@Option
names:-color
description:the color depth (valid: ${COMPLETION-CANDIDATES}) (default: ${DEFAULT-VALUE})
infileback to summary
private File infile
Annotations
@Option
names:-i, --input
description:the PDF files to convert.
required:true
outputPrefixback to summary
private String outputPrefix
Annotations
@Option
names:-prefix, -outputPrefix
description:the filename prefix for image files
pageback to summary
private int page
Annotations
@Option
names:-page
description:the only page to extract (1-based)
passwordback to summary
private String password
Annotations
@Option
names:-password
description:the password to decrypt the document
arity:0..1
interactive:true
qualityback to summary
private float quality
Annotations
@Option
names:-quality
description:the quality to be used when compressing the image (0 <= quality <= 1) (default: 0 for PNG and 1 for the other formats)
showTimeback to summary
private boolean showTime
Annotations
@Option
names:-time
description:print timing information to stdout
startPageback to summary
private int startPage
Annotations
@Option
names:-startPage
description:the first page to start extraction (1-based)
subsamplingback to summary
private boolean subsampling
Annotations
@Option
names:-subsampling
description:activate subsampling (for PDFs with huge images)
SYSERRback to summary
private final PrintStream SYSERR
Annotations
@SuppressWarnings:squid:S106

Constructor Detail

PDFToImageback to summary
public PDFToImage()

Constructor.

Method Detail

callback to summary
public Integer call()

Implements java.util.concurrent.Callable.call.

Doc from java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

Returns:Integer

computed result

changeCropBoxback to summary
private static void changeCropBox(PDDocument document, float a, float b, float c, float d)
mainback to summary
public static void main(String[] args)

Infamous main method.

Parameters
args:String[]

Command line arguments, should be one and a reference to a file.