Eric Lou <ericlou <at> esigntrust.com> writes: > > I’m trying to use following code to remove all fields > from pdf and save as a new pdf which without any fields but remain the > background and text. > > Base on the book page 509, we can use > removeField(String name) to remove a field from a document, > > However, I can only remove the field object, but there > still remain the 3D box there,: >
Your source document is a static XFA form (from Lifecycle Designer). Those forms are built with much of their field appearances in the page's content stream. Ugh... and most of it isn't even in marked content... just line art in the page. The good news (and it's not all that good) is that the page content you want to keep likely IS marked content. So it may be at least theoretically possible to salvage it while you remove the rest. Then again, that's Not Trivial: A PDFs graphic state is modified by most commands. And commands that come later often depend on those before it (generally for position info, but sometimes for things like color, line thickness and so on). Removing some random chunk out of the middle of a content stream is likely to mangle everything drawn afterwards. To correctly remove a section of drawing commands, you need to figure out how they changed the graphic state and replicate those changes so commands that follow produce the correct output. Like I said, Not Trivial. If you have /any/ control over the PDFs you receive, get them rebuilt as AcroForms instead of XFA. Then your code will work just fine. Otherwise... ouch. --Mark Storer ------------------------------------------------------------------------------ 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/
