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?

BR
Maruan

Am 06.05.2014 um 20:58 schrieb Akshay Rawat <[email protected]>:

> 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 ([email protected]) 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.

Reply via email to