Patagames Software Support Forum
»
Pdfium.Net SDK
»
FAQ
»
How to update the font of a PdfFreeTextAnnotation
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,109
Thanks: 7 times Was thanked: 130 time(s) in 127 post(s)
|
Question:I need to update the font of a PdfFreeTextAnnotation but it looks like I need to edit the TextObject used to create the annotation. Is there a way to access that object or s there a better way to change the text font of an annotation? Answer:Code:var doc = pdfViewer1.Document;
var page = doc.Pages[0];
var annot = page.Annots[0] as PdfFreeTextAnnotation;
var font = PdfFont.CreateFont(doc, "Bradley Hand ITC");
string tag =doc.FormFill.InterForm.Fonts.Add(font);
annot.DefaultAppearance = $"/{tag} 14 Tf 0 0 0 rg 1 0 0 RG";
annot.RegenerateAppearances();
page.ReloadPage();
pdfViewer1.Invalidate();
where /{tag} 14 Tf is a font name and size - required 0 0 0 rg is a fill color ( RGB black) - optional 1 0 0 RG is a stroke color (RGB red) - optional Edited by user Saturday, August 21, 2021 11:27:31 PM(UTC)
| Reason: Not specified
|
|
|
|
Patagames Software Support Forum
»
Pdfium.Net SDK
»
FAQ
»
How to update the font of a PdfFreeTextAnnotation
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close