Create text annotation from webviewer Core

Product: webviewer Core

Product Version:8.0.0

Please give a brief summary of your issue:
I want to create a text annotation with webviewer Core that is supported by the .Net SDK. I have been using the FreeText tool, but the text annotation is not merged into the PDF when using the .Net SDK.

Please describe your issue and provide steps to reproduce it:
We are currently trying to use PDFTron Core API with our own UI. Most annotation tool are working fine. I just do not manage to get the free text annotations to be merged into the PDF with the .Net SDK. It seems this is related to an attribute width=“0” added into the freetext annotation xdfd ? Could you help me to resolve that ? Is there a specific configuration that I am missing, our a knew issue about it ?

Thanks!

Please provide a link to a minimal sample where the issue is reproducible:

Hey there,

For a more complete WebViewer API documentation you can refer to this page. Specifically for freetext annotation you can take a look at this class.

So to create a FreeText annotation you would need to instantiate it with the corresponding class:

const {annotationManager, Annotations} = instance.Core
const textAnnot = new Annotations.FreeTextAnnotation();
textAnnot.setX(200);
textAnnot.setY(200)
textAnnot.setWidth(200)
textAnnot.setHeight(50)
textAnnot.setContents('Test freetext annotation');
textAnnot.setIntent('FreeText');
annotationManager.addAnnotation(textAnnot)
annotationManager.drawAnnotations({pageNumber: 1})

I hope this can help you with your development!

Best,
Yixiao