PDF Operations
This post is about doing things the open source way, using tools like Ghostscript and ImageMagick.
Conversion
Use Imagemagick’s convert function.
convert file.jpeg file.pdf
Or, you can make a collection of photos in one PDF
convert [files] outputfile
Merging
When you combine PDFs the outcome can be of low resolution. You can use Ghostscript to improve the results
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=temp.pdf pdf1.pdf pdf2.pdf
Deleting
Use the print function. You can specify ranges when printing like this
1-5,6-8
Update
Concatenating PDFs
I found here a simpler and better solution to the problem described above
pdfconcat -o output.pdf pdf1.pdf pdf2.pdf
Converting an HTML to PDF
You can convert an html file to pdf by printing. However, if the page you’re printing contains links, they would be gone. If you would like to retain the links, I found this tool to be helpful: wkhtmltopdf. To use it, run the command
wkhtmltopdf --page-size A5 html.html pdf.pdf
Use the following if you run into the error described here, use
xvfb-run wkhtmltopdf --page-size A5 html.html pdf.pdf
Extracting Titles
See pdfinfo, a function provided by the Xpdf project.