PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Jul 12, 2024 3:44 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: Wed Oct 20, 2021 12:32 pm 

Joined: Wed Oct 20, 2021 12:11 pm
Posts: 1

i started working with AcroFields.
And i want to replace a "PdfTextField" with a drawn string from "gfx.DrawString" and use the "PdfTextField"s Font.

I found the "PdfTextField"s Font in the (formField.Elements["/DA"] as PdfString).Value as "0 g /TimesNewRoman,Bold 12 Tf".
How do i convert this to a XFont to use it in gfx.DrawString() function ? I need something like XFont.FromString()

//fontAsString  =  "0 g /TimesNewRoman,Bold 12 Tf"
String fontAsString = (formField.Elements["/DA"] as PdfString).Value;

XFont myXFont= XFont.FromString(fontAsString );
gfx.DrawString(text, myXFont, XBrushes.DarkSlateGray, xRect, format);

I want to replace the field with a drawn string because when i fill the field like:
Fields[z].Value = new PdfString(value.ToString());

The value is not displayed with some PDF Viewer and also not in a windows folder as preview

Perhaps you have an idea why not ? I readed some posts telling about "/NeedAppearances" but that does not help.

Thank you very much

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: Google [Bot] and 37 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