Thanks for responding, Paulo. I appreciate it. Here are two PDFs, one is
the original PDF before it runs through ActivePDF. iText can flatten this
one fine. The other is the after ActivePDF file which has the error.
Following is the code I'm using to test as well as the stack trace of the
error.
public static void main(String[] Args) {
try{
FileOutputStream Fo = new
FileOutputStream("c:\\NoteArchive\\PdfTestOut.pdf");
PdfStamper Ps = new PdfStamper(new
PdfReader("c:\\NoteArchive\\PdfTest.pdf"),Fo);
Ps.setFormFlattening(true);
Ps.close();
}catch(Exception e){
e.printStackTrace();
}
}
java.lang.NullPointerException at
com.lowagie.text.pdf.PdfStamperImp.flatFields(PdfStamperImp.java:726) at
com.lowagie.text.pdf.PdfStamperImp.close(PdfStamperImp.java:149) at
com.lowagie.text.pdf.PdfStamper.close(PdfStamper.java:197) at
NoteArchive.NoteArchive.main(NoteArchive.java:403)
Thanks,
Tom Hubbard
-----Original Message-----
From: Paulo Soares [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 11, 2006 2:58 AM
To: [email protected]; Tom Hubbard
Subject: Re: [iText-questions] Flattening ActivePDF generated form fields.
I'll comment when I see the PDF.
----- Original Message -----
From: "Tom Hubbard" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, January 10, 2006 9:42 PM
Subject: [iText-questions] Flattening ActivePDF generated form fields.
> I'm trying to use iText to flatten PDF's with form fields in them and am
> running into trouble when trying to flatten PDF's populated with
> ActivePDF's
> toolkit.
>
> The original (yet to be populated--but still containing the form fields)
> PDF
> flattens just fine. It's only after populating it from the toolkit.
>
> Specifically the code is crashing with a NullPointerException on line 725
> of
> PdfStamperImp.java because objReal in the objReal.isDictionary()call is
> null.
> Following the code, the reason ObjReal is null is that the call to
> appDic.get
> (PdfName.N) returns null. So, when objReal is created from PdfReader it
> returns null.
>
> After stepping through the code a number of times, I cannot figure out
> what is
> going on. It appears this section of code is trying to some special
> positioning, but I'm no expert.
>
> I can get around this by checking to see if obj is null after the call to
> appDic.get(PdfName.N) and skipping the code. It runs and flattens the
> form
> just fine, however since I don't know what is really going on I assume
> it's not
> the smartest thing to do.
>
> Any comments?
>
> Tom Hubbard
> [EMAIL PROTECTED]
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions