I am using below code to split PDf. It compiles fine.But there is no PDf generated generated at the mentioned location. I am using this function in servlet. am I missing something.
public void splitPDF(String inputflname,String imagename,String outfilename) { System.out.println("Split PDF file"); File baseDir = new File(path); File ipfile = new File(baseDir, "WEB-INF/out/" + inputflname); File imgfile = new File(baseDir, "WEB-INF/out/" + imagename); File otfile = new File(baseDir, "WEB-INF/out/" + outfilename); System.out.println("Test-1"); Document document = new Document(); int fromPage =1; System.out.println("Test-2"); try { System.out.println("Test-3"); InputStream inputStream = new FileInputStream(ipfile); InputStream imageStream = new FileInputStream(imgfile); OutputStream outputStream= new FileOutputStream(outfilename); System.out.println("Test-4"); PdfReader inputPDF = new PdfReader(inputStream); PdfReader imagePDF = new PdfReader(imageStream); int totalPages = inputPDF.getNumberOfPages(); System.out.println("Test-5"); PdfWriter writer = PdfWriter.getInstance(document, outputStream); document.open(); PdfContentByte cb = writer.getDirectContent(); PdfImportedPage page; System.out.println("Test-6"); while(fromPage <= totalPages) { System.out.println("Test-7"); document.newPage(); page = writer.getImportedPage(imagePDF, 1); cb.addTemplate(page, 0, 0); System.out.println("Test-8"); page = writer.getImportedPage(inputPDF, fromPage); cb.addTemplate(page, 0, 0); System.out.println("Test-9"); fromPage++; } System.out.println("Test-10"); document.close(); outputStream.close(); System.out.println("Test-11"); } catch (Exception e) { System.out.println("Test-12"); e.printStackTrace(); } } -- View this message in context: http://www.nabble.com/Split-PDF-usinh-Itext-tp25483687p25483687.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/