PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
Convert "Font given as String" to XFont https://forum.pdfsharp.net/viewtopic.php?f=2&t=4293 |
Page 1 of 1 |
Author: | Gioco [ Wed Oct 20, 2021 12:32 pm ] |
Post subject: | Convert "Font given as String" to XFont |
Hi, 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() Code: //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: Code: 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 Gioco |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |