Convert text to fit the page (from commandline)

conversionpdfprintingtext formatting

How to scale short texts (from one word, up to couple of short lines) to fit the page (nice to have choice if centred or aligned to left etc) ?
(from commandline)

Command:

echo Audio | lpr -P Dymo450LabelWriter_network -o raw -o scaling=100

Produces (wrong!!!) just small text in corner (I would like it to be scaled to page):

enter image description here

Please note that I use custom page formats (in above case it's 57mm x 32 mm).

Do you have something using pretty standard packages (simpler than generating LaTeX) ?

(Environment: printer works well with png, pdf, ps)

Best Answer

ImageMagick can do it. See the examples under “Text Handling — Best Fit to Image”.

convert -background white -fill black -density 600x600 -size 1346x756 -gravity center label:'Audio' audio.pdf

It also supports multiline:

convert -background white -fill black -density 600x600 -size 1346x756 -gravity center label:'Audio\nCables' audio_cables.pdf

Output of first command: enter image description here

Output of second command: enter image description here