PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 5:38 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Mon May 04, 2015 10:45 am 
Offline

Joined: Sun May 03, 2015 12:13 pm
Posts: 1
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 133 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group