Discussion:
[iText-questions] AcroFields.SetFieldRichValue Question
Abronits Péter
2016-02-29 13:04:06 UTC
Permalink
Dear Support,

We are loooking for a solution for generating PDF documents using predesigned PDF forms (04_Form.pdf).
We tried to insert some rich-text, but plain text displayed in PDF reader.

PDF field settings in Adobe Acrobat DC application (04_Form.pdf):
[cid:***@01D172F5.277C5A30]

[cid:***@01D172F5.277C5A30]

Rich-Text (src: reqgen.Destination):
<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xtml"
xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"
xfa:contentType="text/html" xfa:APIVersion="Acrobat:8.0.0" xfa:spec="2.4">
<p style="text-align:left">
<b>
<i>
Here is some bold italic text
</i>
</b>
</p>
<p style= "font-size:10pt">
This text uses default text state parameters but changes the font size to 16.
</p>
</body>


Here is some bold italic text

This text uses default text state parameters but changes the font size to 16.


Result (131012226107252443.pdf):
[cid:***@01D172FA.0C9A6310]

Source code:
using (PdfReader pdf = new PdfReader(ApplicationState.Templates["04_Form"]))
using (MemoryStream ms = new MemoryStream())
{
using (PdfStamper stamper = new PdfStamper(pdf, ms))
{
//stamper.AcroFields.GenerateAppearances = false;
stamper.AcroFields.SetFieldRichValue("Destination", reqgen.Destination);
stamper.FormFlattening = true;
stamper.Close();
pdf.Close();
}
}


After setting the GenerateAppearances property to false
stamper.AcroFields.GenerateAppearances = false;


text doesn't apperar:
[cid:***@01D172FA.0C9A6310]

Thanks,
Abronits, Péter
Technikai projektvezetõ / Technical Team Lead

Grape Solutions Zrt.
Telefon / Phone: +36 1 880 9200 | Fax: +36 1 880 9201
Cím / Address: H-1034 Budapest, Bécsi út 58 I. em. | Web: www.grape.hu<http://www.grape.hu/>
Loading...