pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maruan Sahyoun <sahy...@fileaffairs.de>
Subject Re: Set a PDFFormField's value with a specific font size
Date Wed, 07 May 2014 16:33:29 GMT
Hello Akshay

looking at the content of you PDF the differences in font size when in a clicked or inactivated
state come from the fact that there are different fonts and font sizes defined for the normal
appearance /N (object number 12 in your file - 12 0 obj) and the default appearance /DA in
8 0 obj. Changing the definition in 8 0 obj to use the same setting as in 12 0 obj the behavior
seems ok.

How did you create that form and set these values?


Am 06.05.2014 um 20:58 schrieb Akshay Rawat <akshay@clerky.com>:

> 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.

View raw message