When creating an InteractiveFeatures.Annotations.FreeTextAnnotation, how do you set the font name, font size, color, etc? I see there is a DefaultAppearance string and an Appearance object, but don’t see how to set this attributes. Thanks.
Hi Joseph,
for using our products.
have tested the scenario and have observed that in current release version of Aspose.Pdf for .NET, the data type of DefaultAppearance is not correct so its not allowing us to set the appearance attributes for text object. For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-34471. We
will investigate this issue in details and will keep you updated on the status
of a correction.
apologize for your inconvenience.
Thank you for your reply. When will there be an update or patch that fixes this problem?
Hi Joseph,
I have a project due for a client in one week. If this is fixed, I can buy Aspose.PDF for this project. So, will there be a fix available within one week? Thanks.
Hi Joseph,
Has a date been set yet to release a fix for this problem? I have an urgent need (this week) for this fix as stated before. Thank you for your help.
Hi Joseph,
Hi Joseph,
- property string FontName // gets or sets font name;
- property double FontSize // gets or sets default size of text
- property System.Drawing.Color Color (//gets or sets color of the text)
- property TextAligment Alignment (// gets or sets text alignment in the annotation.)
Document doc1 = new
Document(“34471-2.pdf”);<o:p></o:p>
//set font size and color of the annotation:
(doc1.Pages[1].Annotations[1] as FreeTextAnnotation).TextStyle.FontSize = 18;
(doc1.Pages[1].Annotations[1] as FreeTextAnnotation).TextStyle.Color = System.Drawing.Color.Green;
[C#]
//open document
Document pdfDocument = new Document("c:/pdftest/TestReport.pdf");
// instantiate DefaultAppearance object
Aspose.Pdf.InteractiveFeatures.DefaultAppearance default_appearance = new DefaultAppearance("Arial", 28, System.Drawing.Color.Red);
//create annotation
FreeTextAnnotation freetext = new FreeTextAnnotation(pdfDocument.Pages[1], new Aspose.Pdf.Rectangle(200, 400, 400, 600), default_appearance);
// specify the contents of annotation
freetext.Contents = "Free Text";
// add anootation to annotations collection of page
pdfDocument.Pages[1].Annotations.Add(freetext);
// save the updated document
pdfDocument.Save("c:/pdftest/Watermarked_output_FreeText.pdf");
PS, When Contents or TextStyle of the free text annotation is changed, annotation appearance is regenerated to reflect changes.