This page describes how to convert text from the command line to a pdf in linux. It uses the text2pdf.
Download the source:
mkdir -p $HOME/devel/text2pdf/source cd $HOME/devel/text2pdf/source wget http://www.eprg.org/pdfcorner/text2pdf/text2pdf.c
Then add the following line in the code after the last #define
using namespace std;
Also comment out the minimum page dimension condition in line 426 and 430. It should show:
... // if (pageWidth < 72) pageWidth = 72; ... // if (pageHeight < 72) pageHeight = 72; ...
To adapt the placing of the text to the upper left corner, modify line 199 into the following:
sprintf(buf, "1 0 0 1 5 %d Tm\n", pageHeight - 10); writestr(buf);
While ignoring all warnings, build from source with:
g++ text2pdf.c -fpermissive -o text2pdf
See options with this command:
./text2pdf -h
And test with:
./text2pdf -fCourier-Bold -s30 -x100 -y30 > out.pdf <<< "20001" xdg-open out.pdf