Sample Header Ad - 728x90

Converting a TXT file to PDF from the command line using a custom font

1 vote
2 answers
2119 views
I want to convert a UTF-8 txt file to PDF for printing with CUPS. The problem I'm facing is that all tools I've tried have either failed to format the PDF (resulting in a fully white document with no text) or ignored font options. I have also tried converting my text file to PostScript 1st (as suggested in some previous answers to similar topics) but have faced issues with then printing the PostScript files with the added fonts. What I have tried: text2pdf (creates blank document when custom font specified) unoconv (fails to run with network error) LibreOffice CLI (no font parameters) enscript (initial PostScript conversion works however when then printing that PS or converting it to PDF the font reverts to courier) paps (PostScript conversion succeeds but font parameter seemingly ignored as file is the same regardless of what font you specify or whether or not it exists) pandoc (font options ignored)
Asked by psvg200 (11 rep)
Jun 26, 2023, 08:02 PM
Last activity: Jun 3, 2025, 02:04 AM