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

public final Class ImageToPDF

extends Object
implements Callable<Integer>
Class Inheritance
All Implemented Interfaces
java.util.concurrent.Callable
Annotations
@Command
name:imagetopdf
header:Creates a PDF document from images
versionProvider:Version
mixinStandardHelpOptions:true
Imports
java.io.File, .IOException, .PrintStream, java.util.concurrent.Callable, org.apache.pdfbox.pdmodel.PDDocument, .PDPage, .PDPageContentStream, org.apache.pdfbox.pdmodel.common.PDRectangle, org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject, picocli.CommandLine, .CommandLine.Command, .CommandLine.Option

Create a PDF document from images.

Field Summary

Modifier and TypeField and Description
private boolean
private File[]
private boolean
private PDRectangle
private File
private String
private boolean
private final PrintStream

Constructor Summary

AccessConstructor and Description
public
ImageToPDF()

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 PDRectangle
public PDRectangle

Returns:

returns the page size (media box)
getMediaBox
()

Sets page size of produced PDF.

public boolean

Returns:

true if auto, false if not.
isAutoOrientation
()

Gets whether page orientation (portrait / landscape) should be decided automatically for each page depending on image proportion.

public boolean

Returns:

true for landscape orientation
isLandscape
()

Tells the paper orientation.

public static void
main(String[] args)

public void
setAutoOrientation(boolean
true if auto, false if not.
autoOrientation
)

Sets whether page orientation (portrait / landscape) should be decided automatically for each page depending on image proportion.

public void
setLandscape(boolean
use landscape orientation.
landscape
)

Sets paper orientation.

public void
setMediaBox(PDRectangle
the media box of the PDF document.
mediaBox
)

Sets page size of produced PDF.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

autoOrientationback to summary
private boolean autoOrientation
Annotations
@Option
names:-autoOrientation
description:set orientation depending of image proportion
infilesback to summary
private File[] infiles
Annotations
@Option
names:-i, --input
description:the image files to convert
paramLabel:image-file
required:true
landscapeback to summary
private boolean landscape
Annotations
@Option
names:-landscape
description:set orientation to landscape
mediaBoxback to summary
private PDRectangle mediaBox
outfileback to summary
private File outfile
Annotations
@Option
names:-o, --output
description:the generated PDF file
required:true
pageSizeback to summary
private String pageSize
Annotations
@Option
names:-pageSize
description:the page size to use: Letter, Legal, A0, A1, A2, A3, A4, A5, A6 (default: ${DEFAULT-VALUE})
resizeback to summary
private boolean resize
Annotations
@Option
names:-resize
description:resize to page size
SYSERRback to summary
private final PrintStream SYSERR
Annotations
@SuppressWarnings:squid:S106

Constructor Detail

ImageToPDFback to summary
public ImageToPDF()

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

createRectangleback to summary
private static PDRectangle createRectangle(String paperSize)
getMediaBoxback to summary
public PDRectangle getMediaBox()

Sets page size of produced PDF.

Returns:PDRectangle

returns the page size (media box)

isAutoOrientationback to summary
public boolean isAutoOrientation()

Gets whether page orientation (portrait / landscape) should be decided automatically for each page depending on image proportion.

Returns:boolean

true if auto, false if not.

isLandscapeback to summary
public boolean isLandscape()

Tells the paper orientation.

Returns:boolean

true for landscape orientation

mainback to summary
public static void main(String[] args)
setAutoOrientationback to summary
public void setAutoOrientation(boolean autoOrientation)

Sets whether page orientation (portrait / landscape) should be decided automatically for each page depending on image proportion.

Parameters
autoOrientation:boolean

true if auto, false if not.

setLandscapeback to summary
public void setLandscape(boolean landscape)

Sets paper orientation.

Parameters
landscape:boolean

use landscape orientation.

setMediaBoxback to summary
public void setMediaBox(PDRectangle mediaBox)

Sets page size of produced PDF.

Parameters
mediaBox:PDRectangle

the media box of the PDF document.