Am 29.04.2021 um 08:19 schrieb Florian Gumpinger:
Sadly this does not help. I only have a java.awt.Font object and do not
know from which font-file it comes from. So i cannot load this files. And i
only have one font per PDF ... so i do not need to load multiple fonts at
once ... but i need a hint how to solve this with java.awt.Font ... or a
way how i can figure out the font-file to a java.awt.Font object ... Name
of font does not help ... i tried already but the name of the font is not
always like the filename.

Getting the name / location of an java.awt.Font is tricky and depends on the jdk version and it uses internal sun.* classes. You need to use the debugger, then cast to the actual object, see what methods are available, etc. I tried this years ago and after a few hours I had the file name.

You could try to use https://github.com/rototor/pdfbox-graphics2d . This is on top of PDFBox, we have nice contacts with the developer and he's great.

Tilman




Yours
Florian

Am Do., 29. Apr. 2021 um 08:09 Uhr schrieb Tilman Hausherr <
[email protected]>:

Hi,

See the EmbeddedMultipleFonts.java example in the source code download.
java.awt.Font is not supported, nor are complex scripts (Indian, Arabic)

Tilman

Am 29.04.2021 um 08:07 schrieb Florian Gumpinger:
Hello!



I want to create a PDF file with text. The language of the text is
depending on the language-settings in the application. The application
supports many languages … also Chinese, Korean etc. So I cannot work with
one font. In the application i have now the font as java.awt.Font
available. Is there a way to use this direct? For example something like



            contentStream.setFont((PDFont) [java.awt.Font], 10);



or a way to create this with something similar like



            PDFont font = PDTrueTypeFont.loadTTF(doc, [java.awt.Font]);



?



Yours

Florian


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to