Sorry if this is previously covered, but when I try to search the mailing list archives I get an error that /search.php can not be found.
I am getting the following error when I try to add a bookmark to an existing PDF document. Exception in thread "main" java.lang.IllegalArgumentException: Invalid page number 1 at com.lowagie.text.pdf.PdfCopy.getPageReference(PdfCopy.java:355) at com.lowagie.text.pdf.PdfWriter.getCurrentPage(PdfWriter.java:2060) at com.lowagie.text.pdf.PdfOutline.initOutline(PdfOutline.java:332) I followed the instructions for both pdfstamper and pdfCopy and I am getting the same error for both. Any idea's what the cause could be? I am attaching a snippet of my code: // we create a reader for a certain document PdfReader reader = new PdfReader(input_filePath); reader.consolidateNamedDestinations(); int n = reader.getNumberOfPages(); List bookmarks = SimpleBookmark.getBookmark(reader); BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED); if (bookmarks != null) { if (pageOffset != 0) SimpleBookmark.shiftPageNumbers(bookmarks, pageOffset, null); master.addAll(bookmarks); }//end if pageOffset += n; document = new Document(reader.getPageSizeWithRotation(1)); writer = new PdfCopy(document, new FileOutputStream(pdf_file)); //Modify PDF to use outlines writer.setViewerPreferences(PdfWriter.PageModeUseOutlines); document.open(); //Create the content byte PdfContentByte cb = writer.getDirectContent(); //Create template PdfTemplate template = cb.createTemplate(25, 25); //Add position cb.addTemplate(template, 87, 87); //Define the destination PdfDestination d1 = new PdfDestination(PdfDestination.XYZ, 300, 800, 0); //Define the outline PdfOutline out1 = new PdfOutline(cb.getRootOutline(), d1, tab); <---- THIS IS WHERE IT ERRORS OUT PdfImportedPage page; Thank you, Jyran Glucky Advisory Programmer BlueWare, Inc. Strategic HealthWare Solutions 3060 W. 13th Street Cadillac, MI 49601 Phone: (231) 779-0224 ext. 111 Fax: 231-779-1002 mailto:[EMAIL PROTECTED] http://www.blueware.net DID YOU KNOW? BlueWare is the Grand Prize Winner of the 2005 IBM Beacon Award BEST DB2 (Document Management) Application Worldwide. BlueWare Market Share for Hospital Document Management Systems is in 25 states in the US. ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions