Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is importing a truetype font for perl module possible?

After a great deal of toiling I have managed to hack up a perl script that use PDF::Create to create pdf labels for a label printer. The script now works perfectly to suit my needs but the choices of fonts are limited. I have installed a true type font with gnome-font-viewer (I am using Debian Stretch).

According to the docs for PDF::Create: A postscript named "BaseFont" (Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique, Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique, Times-Roman, Times-Bold, Times-Italic, Times-BoldItalic or Symbol) can be used to create the pdf.

How can I add my newly installed true type font to this list of Postscript basefonts so that I can use it to create a PDF? Or is this not possible?

like image 366
gatorreina Avatar asked Jan 28 '26 09:01

gatorreina


1 Answers

There is an old and unresolved ticket requesting that feature on that module, so I suspect for PDF::Create, the answer is no, you can't use TTF fonts (I'd be happy to be proven wrong on that point).

Other Perl modules can use True Type and Open Type fonts. PDF::API2 does support them. I'll confess, I found that module's API to be somewhat intimidating.

Another module I have used extensively is PDF::Reuse which can be used to create PDFs from scratch, or by combining existing pages as templates and overlaying text and other elements. PDF::Reuse also supports the use of True Type fonts.

like image 179
Grant McLean Avatar answered Jan 30 '26 21:01

Grant McLean