Hi,
I have code so far similar to your sample code
I need to apply bold, italic, underline formatting to my free text annotation. Let me know how it can be applied.
Thanks
Hi,
I have code so far similar to your sample code
I need to apply bold, italic, underline formatting to my free text annotation. Let me know how it can be applied.
Thanks
@Sri79
You should use FreeTextAnnotation.TextStyle property
let’s say for the given code ( show original), to change, you need to add:
freetext.TextStyle.Color = System.Drawing.Color.Blue;
freetext.TextStyle.FontSize = 20;
@sergei.shibanov
I am not asking about color or font size. As mentioned in my post, I am asking about Bold, Italic, Underline.
@Sri79
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PDFNET-54957
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Ok. I have created a ticket in Paid support system.
@Sri79
The task was given high priority.
I received a letter with a notification and the priority was changed in the tasks tracker.
Hi,
I just noticed this is the exact functionality I was looking for.
It has been more than half a year since ticket was created, is there any updates on this?
Kind regards,
hiraki
@hiraki.uk
After increasing the priority of the task, the developers studied it.
A temporary variant was proposed and a question was asked.
currently for use Bold and Italic style it is posibble to use RichText property of FreeTextAnnotation:
var pdfDocument = new Document();
pdfDocument.Pages.Add();
// Instantiate DefaultAppearance object
var default_appearance = new DefaultAppearance("Arial", 28, System.Drawing.Color.Red);
// Create annotation
var 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";
freetext.RichText = "<?xml version=\"1.0\"?><body xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:xfa=\"http://www.xfa.org/schema/xfa-data/1.0/\\\" xfa:APIVersion=\"Acrobat:11.0.23\" xfa:spec=\"2.0.2\" style=\"font-size:28.0pt;color:#FF0000;font-weight:normal;font-style:normal;font-family:Arial Bold;font-stretch:normal\"><p dir=\"ltr\"><i>Free Text</i></p></body>";
// Add anootation to annotations collection of page
pdfDocument.Pages[1].Annotations.Add(freetext);
// Save the updated document
pdfDocument.Save("54957-out.pdf");
Would it be enough for the user to be able to set one style for all FreeTextAnnotation text?
Or is it necessary to be able to set different styles for different pieces of text, as in the attached figure (this will be longer to implement and more difficult to use)?
different_styles.png (2.8 KB)
Since no response was received, the decision was made to implement to be able to set different styles for different pieces of text. And in the near future the team planned to tackle the task at hand with this solution option.