Look for AcroFields. replacePushbuttonField(). Paulo
----- Original Message ----- From: "keigwin" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Saturday, September 13, 2008 8:41 PM Subject: Re: [iText-questions] Importing Images through FDF Thank you for your response. Perhaps you could suggest an alternative method for dynamically substituting images in a PDF form at runtime? Paulo Soares wrote: > > Images in FDF are not supported.. > > Paulo > > ----- Original Message ----- > From: "keigwin" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Saturday, September 13, 2008 3:44 AM > Subject: [iText-questions] Importing Images through FDF > > > > I would like to be able to populate a PDF Form with images dynamically. I > have server-side code that generates an FDF containing dynamic data, > including image file paths where needed. I've gotten this approach to > work > by converting the images into PDF templates, and referencing them in the > FDF > using an APRef. The PDF form field receiving the image is a button, and > the > image is set as the button icon. > > Acrobat has no problem importing these image PDFs and rendering them > properly, either using files on my file system or by serving the FDF from > a > web server and rendering the PDF in a browser. > > I would like to do the same thing server-side using iText, but haven't > gotten it to work. My C# code looks like this: > public override void writePdf(Stream p_form_input_stream, Stream > p_pdf_output_stream) > { > Stream l_trimmed_stream = > UtilityStream.trimTextStream(base.m_form_data); > l_trimmed_stream.Position = 0; > FdfReader l_fdf_reader = new FdfReader(l_trimmed_stream); > p_form_input_stream.Position = 0; > PdfReader l_pdf_reader = new PdfReader(p_form_input_stream); > PdfStamper l_stamp = new PdfStamper(l_pdf_reader, > p_pdf_output_stream); > AcroFields form = l_stamp.AcroFields; > form.SetFields(l_fdf_reader); > l_stamp.Close(); > } > The PdfStamper properly accepts non-image fields from the FDF, but not the > images. > > A sample FDF is shown here: > %FDF-1.2 > 1 0 obj << > /FDF << > /Fields[ > <</T(Id)/V(101) >>> > <</T(DataItem3)/V(9876) >>> > <</T(DataItem2)/V(1/1/2001 12:00:00 AM) >>> > <</T(DataItem1)/V(Some String) >>> > << /T (ImageFile)/APRef << /N << /F > (c:\\dev\\xslent\\website\\TestImage.pdf)/Name(imageTemplate) >>>>>> > ] >>> >>> endobj > trailer > << /Root 1 0 R >> > %%EOF > > Any help on how I might make this work would be greatly appreciated! > > K- ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ 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
