org.apache.pdfbox.examples.pdmodel
Class AddImageToPDF

java.lang.Object
  extended by org.apache.pdfbox.examples.pdmodel.AddImageToPDF

public class AddImageToPDF
extends Object

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.

Version:
$Revision: 1.1 $
Author:
Ben Litchfield

Constructor Summary
AddImageToPDF()
           
 
Method Summary
 void createPDFFromImage(String inputFile, String image, String outputFile)
          Add an image to an existing PDF document.
static void main(String[] args)
          This will load a PDF document and add a single image on it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddImageToPDF

public AddImageToPDF()
Method Detail

createPDFFromImage

public void createPDFFromImage(String inputFile,
                               String image,
                               String outputFile)
                        throws IOException,
                               COSVisitorException
Add an image to an existing PDF document.

Parameters:
inputFile - The input PDF to add the image to.
image - 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.
COSVisitorException - If there is an error writing the PDF.

main

public static void main(String[] args)
This will load a PDF document and add a single image on it.
see usage() for commandline

Parameters:
args - Command line arguments.


Copyright © 2002-2010 The Apache Software Foundation. All Rights Reserved.