Line-height for freetext annotation (or some kind of spacing between lines for text annotations)

Hello,
I’m translating annotations from another PDF viewer to PDFTron but the spacing between the lines is different and I can’t seem to find a way to get PDFTron to match.

I was hoping I could generate the XFDF like this but it makes no difference to the line height when rendered:

`

HELLO
HOW ARE YOU?
I’m fine

HELLO HOW ARE YOU? I'm fine

1 0 0 rg /Arial 19 Tf font: Arial 19pt; line-height:.7em !important; text-align: left; color: #FF0000 `

Does anyone know if there’s a way to change the line-height? Ideally through XFDF but even if I have to use the API it might be ok.

Cheers

Hello,

Unfortunately, line-height is not supported by PDFs according to the latest specification I could find (1.7). What is found in the rich text content is also a subset of CSS2 so only a few styles are supported by the specification and the SDK. As for the SDK, we try to match Adobe Acrobat/Reader as closely as we can so that viewing in WebViewer is closer to what will be seen in Adobe Acrobat/Reader.

Annotations can be rendered differently by different viewers. If you want the annotation to look the same, you could apply an appearance to it (a bit tricky right now), but modifying certain appearance-related attributes (color, contents, etc) will cause the original appearance to be discarded in viewers that cannot regenerate the updated appearance. Even with that, viewers can still render however they like and there may be discrepancies between the various viewers.

Andy Huang
Software Developer
PDFTron Systems Inc.

Thank you Andy, good to have the confirmation.
That’s fine I’ll shrink the font size or make the bounding box bigger.

Consider this closed.