If all you want is the form fields, you can go into each page's PdfDictionary 
and chop out PdfName.CONTENTS and PdfName.RESOURCES.  You'll want to do this in 
PdfReader and then call removeUnusedObjects().  Only after you've yanked out 
everything you don't want do you create a Stamper.

PdfReader reader = new PdfReader(...)
int numPages = reader.getNumberOfPages();
for(int i = 1; i <= numPages; ++i) { // pages are 1-indexed
  PdfDictionary pageDict = reader.getPageN( i );
  pageDict.remove( PdfName.CONTENTS );
  pageDict.remove( PdfName.RESOURCES );
}
reader.removeUnusedObjects(); // removes any orphaned images/fonts/etc

PdfStamper stamper = new PdfStamper( reader, ... );
...



--Mark Storer 
  Senior Software Engineer 
  Cardiff.com

#include <disclaimer> 
typedef std::Disclaimer<Cardiff> DisCard; 



> -----Original Message-----
> From: Smicky [mailto:[email protected]]
> Sent: Thursday, November 12, 2009 12:01 AM
> To: [email protected]
> Subject: [iText-questions] How to remove the "background" of 
> an Acroform
> with iText
> 
> 
> 
> Hi,
> 
> To build an acroform, I started from an existing PDF and used 
> Acrobat pro to
> put fields on it. The existing PDF is what I call here the 
> "background" (not
> sure if there is a better terminology)
> 
> For my projet I need to generate : 
> - A PDF, flattened, with the fields filled with dynamic data: 
> that's ok !
> - AA PDF, flattened, with ONLY the fields filled with dynamic 
> data (i.e.
> WITHOUT the PDF "background") : is this possible in iText to 
> remove the
> "background" of the PDF and keep only Acroform fields (and their
> position...)
> 
> 
> I thought I could copy the acroform and insert it on a blank 
> pdf page or
> something but I'm not sure if it's possible or if there is a 
> better way to
> do this.
> 
> Thanks
> -- 
> View this message in context: 
> http://old.nabble.com/How-to-remove-the-%22background%22-of-an
-Acroform-with-iText-tp26285820p26285820.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
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/

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
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/

Reply via email to