Class AddImageToPDF
- java.lang.Object
-
- org.apache.pdfbox.examples.pdmodel.AddImageToPDF
-
public class AddImageToPDF extends java.lang.ObjectThis 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 Constructor Description AddImageToPDF()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreatePDFFromImage(java.lang.String inputFile, java.lang.String imagePath, java.lang.String outputFile)Add an image to an existing PDF document.static voidmain(java.lang.String[] args)This 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.
-
-
-
Method Detail
-
createPDFFromImage
public void createPDFFromImage(java.lang.String inputFile, java.lang.String imagePath, java.lang.String outputFile) throws java.io.IOExceptionAdd 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:
java.io.IOException- If there is an error writing the data.
-
main
public static void main(java.lang.String[] args) throws java.io.IOExceptionThis will load a PDF document and add a single image on it.
see usage() for commandline- Parameters:
args- Command line arguments.- Throws:
java.io.IOException
-
usage
private void usage()
This will print out a message telling how to use this example.
-
-