Am 06.04.2019 um 17:52 schrieb William Pietri:
Thanks! I appreciate both the filed bug and the suggested code:
On 4/6/19 2:52 AM, Tilman Hausherr wrote:
After the line
String fontName = res.add(font).getName();
save the file, close, and load it again.
That does indeed speed things up. It does lead me to a question about
fonts, though.
In my context, the form-fill data is user entered, so it could be in
any language. My strategy for filling fields is:
* try setValue(text) on the field
* if that throws an IllegalArgumentException
o for each font file I have
+ load the font into a new dummy document
+ try rendering the text in the dummy document
+ if it works there, load the font into the real document
+ call setDefaultAppearance on the field with the magic value
as in my sample
Is that the best approach? It seems like it would be better to ask if
something is possible before just doing it, but I couldn't find
reliable ways to to that.
You could also call PDFont.encode() and see whether it throws.
Tilman
Thanks,
William
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]