Hi,
I am using the below code to concatenate pdf's: but the question is how
would i make sure the concatenated PDF is a read-only pdf.
Please advise.
import java.io.*;
import com.itextpdf.text.*;
import com.itextpdf.text.pdf.*;
public class PickTray {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
String[] files = { "C:\\temp\\merge.pdf",
"C:\\temp\\merge.pdf","C:\\temp\\Partner.pdf","C:\\temp\\1.pdf","C:\\temp\\2.pdf","C:\\temp\\3.pdf","C:\\temp\\Lanscape_test.pdf"
};
Document PDFCombineUsingJava = new Document();
PdfCopy writer = new PdfCopy(PDFCombineUsingJava, new
FileOutputStream("C:\\temp\\CombinedPDFDocument.pdf"));
PDFCombineUsingJava.open();
PdfReader ReadInputPDF;
int number_of_pages;
for (int i = 0; i < files.length; i++) {
ReadInputPDF = new PdfReader(files[i]);
number_of_pages = ReadInputPDF.getNumberOfPages();
System.out.println("number_of_page"+
ReadInputPDF.getNumberOfPages());
for (int page = 0; page < number_of_pages; ) {
writer.addPage(writer.getImportedPage(ReadInputPDF, ++page));
}
}
writer.addViewerPreference(PdfName.PICKTRAYBYPDFSIZE,
PdfBoolean.PDFTRUE);
PDFCombineUsingJava.close();
}
catch (Exception i)
{
System.out.println(i);
}
}
}
--
Thanks,
Anil Kotla
------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete
for recognition, cash, and the chance to get your game on Steam.
$5K grand prize plus 10 genre and skill prizes. Submit your demo
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php