I have a base PDF form that I want to fill in code. There are three fields: - FieldOne with Helvetica Bold, 18pt - FieldTwo with Helvetica Bold, 18pt, 180 degrees rotated (upside down) - FieldThree with standard formatting (Helvetica 14pt)
This is the code I use to fill the form fields:
input = PdfReader.Open(template, PdfDocumentOpenMode.Import); if (input.AcroForm.Elements.ContainsKey("/NeedAppearances")) input.AcroForm.Elements["/NeedAppearances"] = new PdfSharp.Pdf.PdfBoolean(true); else input.AcroForm.Elements.Add("/NeedAppearances", new PdfSharp.Pdf.PdfBoolean(true));
PdfTextField fld = (PdfTextField)(input.AcroForm.Fields["FieldOne"]); fld.Text = "New text for FieldOne"; fld = (PdfTextField)(input.AcroForm.Fields["FieldTwo"]); fld.Text = "New text for FieldTwo"; fld = (PdfTextField)(input.AcroForm.Fields["FieldThree"]); fld.Text = "New text for FieldThree";
When I open the result in Adobe Acrobat 9: - The fields are filled, but not visible. When I edit a field the content shows, formatted - When I print the PDF the fields show, but in Arial 10pt all formatting removed (also the rotation).
What am I doing wrong? Or how can I accomplish this?
Thanks, Martin
|