Annotation Freetext Rect Size
Hi all,
maybe the answer to my question is so obvious, that I just can't find it, I don't know. So here I am, hoping for some help.
I programmatically like to add annotations. I already know how to do that. I started with the JavaScript for Acrobat API Reference and a Guide called Developing Acrobat Applications Using JavaScript.
Question in short: How can i determine the correct rect size of the freetext annotation, so that the whole text i place in there is shown? Is there a function to calculate the width and heigth of multiline or single line Text?
Example:
var annot = this.addAnnot({
page: 0,
type: "FreeText",
textFont: font.Helv,
textSize: 10,
rect: [200, 300, 200+200, 300+3*12],
contents: "Line1!\nLonger Line 2!\nReeeaaaaalllyyyy loooooong Line3!",
author: "Me",
width: 1,
alignment: 0 });
I already know how to get the quads from Words inside the document. So I thought I add a new page, write the text that should appear in the annotation, get the quads, transform to rect, delete the page and have my rects. But I figured that I can't add simple Text, is that right?
I am new to the Adobe API and I am stuck with this...
