Problem fixed. The fix will be in the next release.

----- Original Message ----- 
From: "Noah Mattern" <[EMAIL PROTECTED]>
To: <itext-questions@lists.sourceforge.net>
Sent: Friday, January 21, 2005 5:52 PM
Subject: [iText-questions] AcroFields error at
com.lowagie.text.pdf.AcroFields.fill(AcroFields.java:99)


> A predecessor of mine used an old (acrobat 3) SDK to create an API which
> allows for fields to be placed on a PDF via a small GUI tool.  Using
iText,
> I am unable to create an AcroFields object based on the fields created
with
> this tool.  I have attached a sample PDF which has a single field
> (EVENT_DATE) which was added using the tool.  The error seems to be deep
in
> the AcroFields class:
>
> Error: java.lang.Exception: Error during field operation:
> java.lang.Exception: Error getting AcroFields:
java.lang.ClassCastException
> java.lang.ClassCastException
>         at com.lowagie.text.pdf.AcroFields.fill(AcroFields.java:99)
>         at com.lowagie.text.pdf.AcroFields.<init>(AcroFields.java:75)
>         at
> com.lowagie.text.pdf.PdfStamperImp.getAcroFields(PdfStamperImp.java:305)
>         at
> com.lowagie.text.pdf.PdfStamper.getAcroFields(PdfStamper.java:215)
>         at AcroFieldTest.main(AcroFieldTest.java:57)
>
> The sample code below and the sample PDF attached (created via Acrobat4
and
> the API) can be used to replicate the error.  I have several hundred PDFs
> that have between 5 and 50 fields which I am hoping to use iText on.
>
> Any ideas would be greatly appreciated.
>
> Thank you
> Noah Mattern
> Enterprise Information Solutions
>
> <---- sample code ---->
>
> /*
>  * AcroFieldTest.java
>  *
>  * Created on January 21, 2005, 9:46 AM
>  */
>
> /**
>  *
>  * @author  Noah Mattern
>  */
>
> import java.util.*;
> import java.sql.*;
> import java.io.*;
>
> import com.lowagie.text.*;
> import com.lowagie.text.pdf.*;
>
> public class AcroFieldTest {
>
>     public static void main(String args[]) {
>
>     try {
>         byte[] pdfBytesOut = null;
>         PdfReader reader = null;
>         ByteArrayOutputStream pdfOutput  = null;
>         PdfStamper stamper = null;
>         AcroFields form = null;
>         HashMap fieldInfo = null;
>         String tokenValue = "";
>
>         System.out.println("Start");
>
>         // a PDF made via old API (attached)
>         String filename = "c:\\temp\\FormFieldsAPI.pdf";
>
>         FileInputStream inStream = new FileInputStream( filename );
>         int byteCount = inStream.available();
>         byte[] pdfBytes = new byte[byteCount];
>         inStream.read(pdfBytes, 0, byteCount);
>
>         // read the PDF into an object
>         reader = new PdfReader( pdfBytes );
>
>         // make the output object
>         pdfOutput = new ByteArrayOutputStream();
>
>         stamper = new PdfStamper(reader, pdfOutput);
>
>         // create an AcroFields based on the fields on the form
>         try {
>             stamper.setFormFlattening(true);
>             try{
>                 /******* THIS LINE FAILS *******/
>                 form = (AcroFields) stamper.getAcroFields();
>             } catch( Exception e ){
>                 e.printStackTrace();
>                 throw new Exception( "Error getting AcroFields: " +
> e.toString() );
>             }
>
>         } catch( Exception e ){
>             throw new Exception( "Error during field operation: " +
> e.toString() );
>         }
>
>         // close the stamper object
>         try{
>             stamper.close();
>         }
>         catch( Exception e ){
>             System.out.println( "Unable to close the PdfStamper: " +
> e.toString() );
>         }
>
>         System.out.println("End");
>
>         }
>         catch( Exception e ) {
>             System.out.println( "Error: " + e.toString() );
>         }
>     }
> }
>



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to