Have anyone worked using PDFNet where the annot needs to be resized? For simplicity, currently i set the text of the annot using
annot.setContents(text)
annot.refreshAppearance()
pdfView.update()
However, if the text is too long where it exceeds the annot's width, it cant be resized and the text will be trimmed as the annot's width isnt wide enough. I checked the documentation and it seems there is a resize function, however the parameter it is taking isn't clear. Anyone with knowledge on this, thanks in advance
How are you creating the (free-text) annotations? If you are using a
PTToolManagerand creating the annotations withPTFreeTextCreatetool class, then you can enable auto-resize for free-text annotations withtoolManager.isAutoResizeFreeTextEnabled = trueUsing the
PTDocumentControllerclass for viewing and annotating documents is highly recommended if possible, otherwise aPTPDFViewCtrlandPTToolManagershould be used.The
PTAnnot.resize()function is used to set the PDF page rect of the annotation, preserving (ie. scaling) the annotation's appearance to fill its new rect.Auto-resizing a free-text annotation without a
PTToolManagerwould require calculating (yourself) the size of the text. ThePTToolManagerAPI approach is recommended.