It's a bug. Replace in PdfCopyFieldsImp.java line 311: PdfFormField.mergeResources(resources, (PdfDictionary)PdfReader.getPdfObject(dr));
Best Regards, Paulo Soares ________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Malloy, James Sent: Monday, April 12, 2004 8:18 PM To: [EMAIL PROTECTED] Subject: [iText-questions] PdfCopyFields I am attempting to use PdfCopyFields to concatinate and fdfmerge. When I run the following code I get the exception: ExceptionConverter: java.lang.ClassCastException: com.lowagie.text.pdf.PRIndirectReference at com.lowagie.text.pdf.PdfCopyFieldsImp.createWidgets(PdfCopyFieldsImp.jav a:311) at com.lowagie.text.pdf.PdfCopyFieldsImp.mergeField(PdfCopyFieldsImp.java:3 55) at com.lowagie.text.pdf.PdfCopyFieldsImp.mergeWithMaster(PdfCopyFieldsImp.j ava:393) at com.lowagie.text.pdf.PdfCopyFieldsImp.mergeFields(PdfCopyFieldsImp.java: 402) at com.lowagie.text.pdf.PdfCopyFieldsImp.closeIt(PdfCopyFieldsImp.java:257) at com.lowagie.text.pdf.PdfCopyFieldsImp.close(PdfCopyFieldsImp.java:239) at com.lowagie.text.pdf.PdfCopyFields.close(PdfCopyFields.java:99) at com.mm.enterprise.utils.pdf.NewMerger.fillAndMergeFdf(NewMerger.java:36) at com.mm.enterprise.utils.pdf.FormHandler.processPdf2(FormHandler.java:80) at com.mm.enterprise.utils.pdf.FormHandler.mergeLast(FormHandler.java:53) at com.mm.enterprise.utils.pdf.PdfAppendMergeTest.process(PdfAppendMergeTes t.java:51) at com.mm.enterprise.utils.pdf.PdfAppendMergeTest.main(PdfAppendMergeTest.j ava:9) Is this a known issue? Is there a work-around? ------------------------------------------------------------------------ - The code: try { ByteArrayOutputStream pdfConcatStream = new ByteArrayOutputStream(); OutputStream pdfStream = dest.getDestinationType(); PdfCopyFields appender = new PdfCopyFields(pdfConcatStream); while (files.hasMoreFiles()) { //files is basically a list of byte[] InputPDFFile currentFile = files.nextFile(); PdfReader formReader = new PdfReader(currentFile.getFile()); appender.addDocument(formReader); } appender.close(); PdfReader concatedFileReader = new PdfReader(pdfConcatStream.toByteArray()); PdfStamper stamp = new PdfStamper(concatedFileReader, pdfStream); AcroFields form = stamp.getAcroFields(); byte[] fdf_in = data.getBytes(); FdfReader fdf = new FdfReader(fdf_in); form.setFields(fdf); stamp.close(); pdfConcatStream.close(); pdfStream.close(); } catch (Exception e) { Jim Malloy Enterprise Application Services --------------------------------------------------------- This e-mail transmission may contain information that is proprietary, privileged and/or confidential and is intended exclusively for the person(s) to whom it is addressed. Any use, copying, retention or disclosure by any person other than the intended recipient or the intended recipient's designees is strictly prohibited. If you are not the intended recipient or their designee, please notify the sender immediately by return e-mail and delete all copies. --------------------------------------------------------- ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions