In this program we are going to concatenate two pdf files
into a pdf file through java program. The all data of files
are concatenated into
the pdf. You can concentrate only two files into a single file.
In this example we need iText.jar file, without this jar file we never compile our application . The package we need to import are
The java.io.FileOutputStream class is used to create file.T
lowagie.text.pdf.PdfCopy class is used to make copies of
PDF documents and It extends PdfWriter.
The com.lowagie.text.pdf.PdfReader class is used to
read pdf from specified file. PdfReader class throws an IOException
and extends Object class.
To make the program for concatenate pdf files firstly we will make a class Concanenate. Remember the name of the file should be such that, if any other person sees the example then just by seeing the name of the program he can understand what the program is going to do without seeing the code.
The steps to execute this program:
Inside this class declare the main method which must throws Exception. After that follow the simple steps find the version:
The code of the program is given below:
The output of the program is given below:
Posted on: April 17, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles