Class AddImageToPDF
java.lang.Object
org.apache.pdfbox.examples.pdmodel.AddImageToPDF
This is an example that creates a reads a document and adds an image to it..
The example is taken from the pdf file format specification.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreatePDFFromImage(String inputFile, String imagePath, String outputFile) Add an image to an existing PDF document.static voidThis will load a PDF document and add a single image on it.private voidusage()This will print out a message telling how to use this example.
-
Constructor Details
-
AddImageToPDF
public AddImageToPDF()
-
-
Method Details
-
createPDFFromImage
public void createPDFFromImage(String inputFile, String imagePath, String outputFile) throws IOException Add an image to an existing PDF document.- Parameters:
inputFile- The input PDF to add the image to.imagePath- The filename of the image to put in the PDF.outputFile- The file to write to the pdf to.- Throws:
IOException- If there is an error writing the data.
-
main
This will load a PDF document and add a single image on it.
see usage() for commandline- Parameters:
args- Command line arguments.- Throws:
IOException
-
usage
private void usage()This will print out a message telling how to use this example.
-