How to work with pdf files in Fatdog

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
Wognath
Posts: 423
Joined: Sun 19 Apr 2009, 17:23

How to work with pdf files in Fatdog

#1 Post by Wognath »

On a recent morning, I had to scan documents and prepare PDFs on short notice. This led me to make a list, for future reference, of pdf utilities available in Fatdog 702. I hope it's useful. Additions would be welcome.

text to PDF
Abiword saves to pdf
puppypdf converts abw, doc, rtf, txt to pdf.

image to PDF
1)PeasyPDF works if Ghostscript is installed from the repo.
2)Gimp can export to pdf
3)Command-line utilities:

Code: Select all

jpegtopnm file.jpg | pnmtotiff > temp.tif
tiff2pdf -p letter -j -q 50 temp.tif > file.pdf
Add -F option to expand graphics to fill pdf.

in addition to jpegtopnm, there are 20 others including bmptopnm, pngtopnm, giftopnm. But pstopnm doesn't work: it appears to require Ghostscript.

tiff2pdf jpeg compression option ( -j -q ##) doesn't work with the binary included in Fatdog 702 (distorts colors). The attached newer version (from ftp.remotesensing.org/pub/libtiff/tiff-4.0.6.tar.gz) allows these options to be used. Without compression, the pdf is larger than the jpeg.

combine PDFs

Code: Select all

pdfunite *.pdf combined.pdf
pdfunite file1.pdf, file2.pdf combined.pdf
encrypt pdf

Code: Select all

qpdf --encrypt p4ssw0rd "" 128 -- file.pdf file-encrypted.pdf
The encrypt option is --encrypt user-pwd owner-pwd key-length [restrictions] -- http://qpdf.sourceforge.net/files/qpdf-manual.html
Attachments
tiff2pdf.tar
Newer binary with working jpeg compression
(70 KiB) Downloaded 212 times

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

Re: How to work with pdf files in Fatdog

#2 Post by jamesbond »

Thanks Wognath.
Wognath wrote:But pstopnm doesn't work: it appears to
require Ghostscript.
Anything that reads or outputs to Postscript ("PS") will most likely need ghostscript.
tiff2pdf jpeg compression option ( -j -q ##) doesn't work with the binary included in Fatdog 702 (distorts colors).
Ah, that's why I didn't see it - I used black and white image for testing (and it looked okay). I'll get tiff2pdf updated in the repo.

Another tool to consider is pdftk https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/ which you can get from the repo. It has a rather large dependency though, you need to install aaa-gcc-libs-full too.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#3 Post by rcrsn51 »

Nice work. Here are some observations.

Puppypdf should have been retired long ago. It just sends the document to Abiword, which produces an inferior PDF. The preferred method is to load the document into a word processor and use Print > Print to File.

Code: Select all

jpegtopnm file.jpg | pnmtotiff > temp.tif
tiff2pdf -p letter -j -q 50 temp.tif > file.pdf
Peasyscan has switched to using tiff-tools and the matching libtiff for saving a scan to PDF. I was getting better results than with Ghostscript.

I debated incorporating libtiff into PeasyPDF, but PeasyPDF already uses Ghostscript for things like extraction.

[Edit] If you want to combine a bunch of JPEGs into a single PDF, the BEST tool is img2pdf. It is discussed in the PeasyPDF how-to.

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#4 Post by rufwoof »

MasterPDFeditor is a great program IMO. You can add attachments etc.

I've installed the latest version direct from CodeIndustry https://code-industry.net/free-pdf-editor/ and its working really well.
Attachments
p.jpg
(49.18 KiB) Downloaded 388 times

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

#5 Post by step »

The contrib repo includes also:

wkhtmltopdf 0.12.3 dev-79ff51e (PDF cli converter)
wkhtmltopdf and wkhtmltoimage are open source (LGPLv3) command
line tools to render HTML into PDF and various image formats
using the Qt WebKit rendering engine. These run entirely
"headless" and do not require a display or display service.

https://bitbucket.org/wkhtmltopdf/wkhtmltopdf
http://wkhtmltopdf.org/downloads.html
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]

Wognath
Posts: 423
Joined: Sun 19 Apr 2009, 17:23

#6 Post by Wognath »

Sorry to bump after so long. I just found this and thought it would be useful to add.
My original post was about utilities already present in Fatdog. But if libreoffice is installed (FD600 repo), a fairly fast command-line conversion of documents to pdf is available:

Code: Select all

/opt/libreoffice3.6/program/soffice --headless --convert-to pdf --outdir ~/NewDir file-to-convert
I have tried this on ppt, doc, xls, jpg and htm files. Occasional format problems or dropped image, esp. htm. Links survive the conversion.
Replacing file-to-convert by * does all files in working directory.
--outdir is optional; without it, output goes to working directory
Similar commands will convert to other formats, but a filter may need to be specified. See
https://ask.libreoffice.org/en/question ... -parameter
Although it doesn't open the gui, this creates a large (>20M) config file :(

Post Reply