I want to convert .txt
files to .pdf
. I'm using this:
ls | while read ONELINE; do convert -density 400 "$ONELINE" "$(echo "$ONELINE" | sed 's/.txt/.pdf/g')"; done
But this produces one "error" — if there's a very long line in the text file, it doesn't get wrapped.
Input text
Output PDF
—
Also, it would also be great if the output PDF could contain text, instead of images of text.
I have many-many-many TXT files. So don't want to do it by hand. I need an automatic solution, like the one I mentioned above.
Best Answer
One method is to use CUPS and the PDF psuedo-printer to "print" the text to a PDF file.
Another is to use enscript to encode to postscript and then convert from postscript to PDF using the ps2pdf file from ghostscript package.