timrs2998 / pdf-builder

PDF builder written in Kotlin with a statically typed DSL
https://timrs2998.github.io/pdf-builder/
GNU General Public License v3.0
57 stars 16 forks source link

ttf #15

Closed sysmat closed 5 years ago

sysmat commented 5 years ago

Is it possible to use ttf file for fonts?

Regards, Tomaž

timrs2998 commented 5 years ago

Yes. First, load the ttf file as a PDFont. You can then assign the PDFont to a TextElement.

PDFont font = PDTrueTypeFont.loadTTF(document, "Arial.ttf");
TextElement textElement = new TextElement(document);
textElement.setPdFont(font);

Make sure the font is embedded inside the document when you distribute to end-users.

See:

sysmat commented 5 years ago

Thx for information I was thinking as DSL