I am trying to add an image to an AcroField. The code is like this, 

            PdfContentByte overContent = stamp.GetUnderContent(1); 
            iTextSharp.text.Image logo =
iTextSharp.text.Image.GetInstance(@"C:\temp\logo.jpg"); 
            float[] logoArea = fields.GetFieldPositions("Logo"); 
            iTextSharp.text.Rectangle logoRect = new Rectangle(logoArea[1],
logoArea[2], logoArea[3], logoArea[4]); 
            logo.ScaleToFit(logoRect.Width, logoRect.Height); 
            logo.SetAbsolutePosition(logoArea[1] - logo.ScaledWidth +
(logoRect.Width - logo.ScaledWidth) / 2, logoArea[2] + (logoRect.Height -
logo.ScaledHeight) / 2); 
            PdfContentByte overContext =
stamp.GetOverContent((int)logoArea[0]); 
            overContent.AddImage(logo); 

            //stamp.FormFlattening = true; 

But the image is not showing on the location if I saved file PDF form as a
dynamic XML form unless I flatten the form. 

When I saved the form as static PDF form, it will work without flattening. 

I want to keep saving the form as dynamic and I don't want to flatten the
form. Anyone has a solution. 

Thanks. 

PS. I am using LC Designer 8.0 and iTextSharp 5.0.1.1. Also if I saved the
form as Acrobat 8 dynamic XML form, the GetFieldPositions doesn't work. But
Acrobat 7 format works. 

-- 
View this message in context: 
http://old.nabble.com/AddImage-doesn%27t-show-the-image-when-using-dynamic-XML-PDF-form-tp28287706p28287706.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to