I also need the original PDF. 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Patrick Lee
> Sent: Tuesday, November 02, 2004 5:14 PM
> To: [EMAIL PROTECTED]
> Subject: [iText-questions] (no subject)
> 
> Hi, 
> 
> I'm having a problem with partialFormFlattening, which
> I wonder has anyone come across. I want to leave some
> fields on a pdf as editable and ones that have had
> data filled into them, I want to flatten.
> So I've called 
> 
>  stamp.setFormFlattening(true);
>  stamp.partialFormFlattening("ISG_RSV_TIN1");
> 
> on my stamper, but no fields are flattened. If I take
> out the call to "partialFormFlattening" then all
> fields are flattened as I would expect.
> 
> I've traced into the PDFStamperImpl.flatFields code
> and it looks like the when the stamper tries to
> retrieve the PdfDictionary it's getting null. 
> 
> PdfDictionary appDic =
> (PdfDictionary)PdfReader.getPdfObject(merged.get(PdfName.AP));
> 
> This does not happen when the call to
> partialFormFlattening is omitted.
> 
> Any help greatly appreciated, 
> 
> thanks
> 
> -patrick
> 
> P.S. Here's my whole code snippet.
> 
> package com.blah;
> 
> import java.io.File;
> import java.io.FileOutputStream;
> import java.util.Collection;
> import java.util.HashMap;
> import java.util.Iterator;
> 
> import com.lowagie.text.pdf.AcroFields;
> import com.lowagie.text.pdf.PdfReader;
> import com.lowagie.text.pdf.PdfStamper;
> 
> /**
>  * @author dk
>  *
>  * To change the template for this generated type
> comment go to
>  * Window>Preferences>Java>Code
> Generation>Code and Comments
>  */
> public class PDFModifier {
> 
>       public static void main(String[] args) {
>               try {
>                       File pdfDirectory = new File("c:/Documents and
> Settings/DKenny/My Documents/compliance/pdfs from
> ping/27Oct04/");
>                       File noPrintDirectory = new File(pdfDirectory,
> "noprint");
>                       if (!noPrintDirectory.exists()) {
>                               noPrintDirectory.mkdir();
>                       }               
>                       String [] files = pdfDirectory.list();
>                       System.out.println("Found " + files.length + "
> files");
>                       for (int i = 0; i < files.length; i++) {
>                               System.out.println(files[i]);
>                                                               
>                               File noPrintFile = new 
> File(noPrintDirectory,
> files[i]);
>                               if (noPrintFile.exists()) {     
>                       
>                                       
> System.out.println("deleting oldfile:" +
> noPrintFile.delete());
>                               }
>                               
>                               File file = new 
> File(pdfDirectory, files[i]);
>                               PdfReader inputPDF = new
> PdfReader(file.getAbsolutePath());
>                               PdfStamper stamp = new 
> PdfStamper(inputPDF, 
>                                        new 
> FileOutputStream(noPrintFile));
>                               
>                               
> //stamp.partialFormFlattening("ISG_RSV_NAME1");
>                               stamp.setFormFlattening(true);
>                               boolean worked =
> stamp.partialFormFlattening("ISG_RSV_TIN1");
>                               if (worked) {
>                                       
> System.out.println("partialFormFlattening
> worked");
>                               }
>                               else {
>                                       
> System.out.println("partialFormFlattening didn't
> work");
>                               }
> 
>                               stamp.close();
>                               break; // just do one for the moment.
>                       }
>               }
>               catch (Exception e) {
>                       System.out.println("Got a dirty big 
> exception - " +
> e.getMessage());
>                       
>               }
>       }
> }
> 
> 
> 
>               
> __________________________________ 
> Do you Yahoo!? 
> Check out the new Yahoo! Front Page. 
> www.yahoo.com 
>  
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Sybase ASE Linux Express Edition - download now for FREE
> LinuxWorld Reader's Choice Award Winner for best database on Linux.
> http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id065&op=click
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to