Lars Eirik Rønning wrote: > I fully understand your concern when it comes to the possibility of > destroying the output, however in our case we have full control of the > original pdf that will be read.
OK. > The idea is that someone with esthetics produce a nice pdf. I have a counter-question: can this person produce a PDF whare the XObjects have the /OC entry in their stream dictionary? That would make your task so much easier... > This pdf will then be opened and images and graphics that belong to a > certain layer will be replaced with new images. > Do you still belive that this is a hopeless task? It's not hopeless, but tricky. You should parse the content stream (with PRTokeniser or something else) and look for the PdfName "/OC". The PdfName that follows this name (for instance "/MC0") tells you what layer is in play (you can find a reference to this layer in the /Properties entry of the page's Resource dictionary). Inside the BMC/EMC sequence that follows, look for the "Do" operator. The name preceding this operator refers to the XObject (for instance "/Fm0"). You can find the location of that XObject by inspecting the /XObjects entry of the page's resource dictionary. Getting that PRStream with PdfReader and replacing its data is the easy part. The tricky part is parsing the content stream to find the layers and the corresponding XObjects. It gets less tricky if the content stream is "predictable" (and that's more or less what you're saying). > We are fully aware that this is not an easy and generalizable way of > doing it, but it should be possible? It may be feasible. -- This answer is provided by 1T3XT BVBA ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar