sweet. so add outlines regardless of whether the PDF is bound for print or web and then, if print bound, nuke the outlines thereby decreasing the file size. My main goal is to keep the file size as small as possible for print bound PDFs, as they are sent to a 3rd party for printing.
great idea...sacrifice some processing time to minimize complexity. Jason -----Original Message----- From: 1T3XT info [mailto:[email protected]] Sent: Sun 7/19/2009 3:34 AM To: Post all your questions about iText here Subject: Re: [iText-questions] PdfDestinations Jason Berk wrote: > My code needs to cut two versions of a pdf. One bound for printing and > one bound for the website. > > We only want to use bookmarks in the PDF bound for the website. > > I did some testing, and adding a PdfDestination by itself adds no size > to the file unless that destination is added to a PdfOutline. > > Knowing that, I want to let all my code add common components and > destinations like so....and in the end, if a condition exists, add the > destinations to the correct outline. > > Something like this: > > PdfContentByte cb = writer.getDirectContent(); > > ArrayList<PdfDestination> bookmarks = new ArrayList<PdfDestination>(); > > addStuff(bookmarks); > addMoreStuff(bookmarks); > addEvenMoreStuff(bookmarks); > > If( useBookmarks ){ > for (PdfDestination d : bookmarks) { > //add the destination to the appropriate parent > //this is where I need help! > } > } I'm not sure if I understand, but I think you should work the other way round: create the PDF with outlines (what you call bookmarks). Then before you close the document decide if the bookmarks have to be kept. If not: if (noBookmarksNeeded) { writer.getRootOutline().setKids(new ArrayList()); } This removes all the kids from the root element of the outline tree, so no bookmarks will be added to the PDF. -- This answer is provided by 1T3XT BVBA http://www.1t3xt.com/ - http://www.1t3xt.info ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ iText-questions mailing list [email protected] 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/ The PEN is now mightier than the PIN. Simply use your PEN instead of your PIN and sign for your PEFCU Visa Check Card purchases. Earn bonus points redeemable for gift and travel awards. Combine PEFCU Visa check card and credit card points for even more rewards. ***This is a transmission from Purdue Employees Federal Credit Union (PEFCU) and is intended solely for its authorized recipient(s), and may contain information that is confidential and or legally privileged. If you are not an addressee, or the employee or agent responsible for delivering it to an addressee, you are hereby notified that any use, dissemination, distribution, publication or copying of the information contained in this email is strictly prohibited. If you have received this transmission in error, please notify us by telephoning (765) 497-3328 or returning the email. You are then instructed to delete the information from your computer. Thank you for your cooperation.***
<<winmail.dat>>
------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge
_______________________________________________ iText-questions mailing list [email protected] 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/
