Currently we try to add a small feature which can update the font-size during resizing the free hand text box to make the text always full fill the whole box. But I did not find the right API to do this, I tied to extend moseMove handler of AnnotationSelectTool. But there are several problems:
I cant detect is this a resizing or relocating of box.
I cant detect the resize direction (right or left, top or bottom)
The initial text box is not big enough to show all text. Expected behaviour
update the font-size during resizing the free hand text box to make the text always full fill the whole box Link to document
{Provide a link to the document in question if possible}
The PDF spec says that annotations with a font size of 0pt should be automatically calculated, so you can do just that by setting the FontSize to 0 every time a FreeTextAnnotation is created.
Unfortunately our implementation is a little bit buggy right now as there is a bug in calculating the line height, but we will look to fix this very soon.
Hi, Logan
thanks for your help, this works but only when you resize the rect of text. and the problems are:
initial fontsize is too small when add a new one.
the fontsize will always be reset to 0pt when trying modify the text string.
so is there a way which can give an initial fontsize when add and still keep the fontsize fill the whole rect when resize the rect after added. and also to keep the current fontsize when edit text content.
We found a couple bugs in the FreeTextAnnotation that are preventing us from fulfilling all these requirements at once. We are going to investigate ASAP, and it will be fixed in a future version. I will let you know when it is released.
As a side note, you can set the default font size of annotations by using setStyles
However, this does not interact nicely with the 0pt trick right now, so it’s kind of one or the other for now. Again, ill let you know when this is fixed!
thanks for your help, currently we try to use pdfjs express to build form,but it doest not work, so is there any example show how to build a form via pdfjs express.