PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Sep 27, 2024 5:15 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sat Jul 17, 2010 7:05 am 
Offline

Joined: Sat Jul 17, 2010 7:00 am
Posts: 2
Hi there,

Hope someone can help with this issue, I have a PDF with AcroFields (mostly text fields) which I am populating using PDFSharp.

When I click on the AcroFields in Adobe Acrobat and type, the text is vertically centered in the text field.

However, when I insert text into the field using code:

((PdfSharp.Pdf.AcroForms.PdfTextField)pdfTemplateDocument.AcroForm.Fields["FIRST_NAME"]).Text = "John";

... the text defaults to top left corner of the text box.

I want the text to be vertically centered but I cannot find a setting that controls this.

Strangely, if I open the new PDF I create in Acrobat (with all the text values aligned top left of each AcroField) and click on each one, they align back to the center.

If I tab out, they return back to the left corner but if I type an additional character into the textbox it will stay vertically centered.

Anyone seen anything like this or have any tips to resolve?

Thanks,
Wilson.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 18, 2010 1:06 am 
Offline

Joined: Sat Jul 17, 2010 7:00 am
Posts: 2
For anyone looking for a resolution to this issue, I downloaded the source code and modified it to suit my requirements.

There are various XStringFormats, one of which is TopLeft, which was used in the rendering method for the PDFTextField class.

I added my own XStringFormat - CenterLeft - and changed the rendering method in the PDFTextClass to use that instead.

Rebuilt the DLL, included it into my project, problem solved.


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 107 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:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group