pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Akshay Rawat <aks...@clerky.com>
Subject Re: Set a PDFFormField's value with a specific font size
Date Tue, 06 May 2014 18:58:44 GMT
Also an example of such a generated pdf is here - http://monosnap.com/file/5fxGhQSdXszX4DIoTyGguZ3ploinAC


On May 6, 2014 at 11:18:17 PM, Akshay Rawat (akshay@clerky.com) wrote:

Hello,

I have a very simple use-case for a filling up an acroform. I have a non-multi line text field.
I would like to resize the font size to fit in the width of the text field.

The PDF spec mentions that a font size of 0 implies auto fit to width. However PDFBox - 1419 
& PDFBOX-1402 mention that this isn’t supported in pdfbox.

Hence I have some small logic to calculate the font-sizes based on the widths etc. However
I’m facing problems setting the font size.

I’m seeing the behavior mentioned in PDFBox - 1419

> Starts out with incorrect font size. If I click into the field, it displays correctly.
Click outside the field, it reverts back to the wrong display.


Code :

    pdfFormField.getDictionary.setString(COSName.DA, "/Helv 10 Tf 0 g”)



Any pointers or help would be much appreciated.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message