Edit Freetext annotation bold, italic, dynamic text programatically

Hello All, 

I want to edit the freetext annotation settings for a rendered annotation. I can set the freetext settings before drawing it like this 

this.pdfviewerControl.freeTextSettings.defaultText = 'Text1';

      this.pdfviewerControl.freeTextSettings.fontSize = 12;

      this.pdfviewerControl.freeTextSettings.textAlignment = 'center';dynamic 

      this.pdfviewerControl.freeTextSettings.fillColor = '#fff';

      this.pdfviewerControl.freeTextSettings.borderColor = 'blue';

      this.pdfviewerControl.freeTextSettings.borderWidth = 1;

      this.pdfviewerControl.freeTextSettings.fontStyle = 2;

But when I edit annotation from the annotation collection I cant find the values for the (italic, Bold & dynamic Text). I've managed to change the font size and color and the alignment for a previously rendered annotation like this 

this.pdfviewerControl.annotationModule.selectAnnotation(this.pdfviewerControl.annotationCollection[index].annotationId);

        this.pdfviewerControl.annotationCollection[index].fontSize = 16;

        this.pdfviewerControl.annotationCollection[index].textAlign = 'left';

        this.pdfviewerControl.annotation.editAnnotation(this.pdfviewerControl.annotationCollection[index]);

Thanks,
Esmail


1 Reply

SK Sinthiya Kalimuthu Syncfusion Team August 24, 2022 07:36 AM UTC

Hi Mohamed,


You can add the dynamic text programmatically. And if you want to bold the text, you need to use the isBold property. We have shared the sample for your requirement. Kindly refer it and revert to us if you have any concerns on it.


Sample - https://stackblitz.com/edit/angular-dxub1a?file=app.component.ts,app.component.html


Regards,

Sinthiya K


Loader.
Up arrow icon