Convert documents and images into PDF on linux

In this post I’ll try tomerge all the different approaches to convert any document format to PDF in linux

convert images to PDF

install ImageMagick toolkit

apt-get install imagemagick

and with the terminal type

convert imagename.extension outputname.pdf
eg: convert stars.jpg stars.pdf

you can also batch convert several images into one PDF file:

convert *.jpg output.pdf

—-

The GIMP is capable to exporting images to PDF.

convert CHM file directly to PDF

simply use chm2pdf


sudo apt-get install chm2pdf

and use it as follows:

chm2pdf --book source.chm

other switches are –continuous (no breaks) and –webpage (breaks for each file)

convert CHM files to HTML than PDF

CHM files, known as Microsoft Compressed HTML Help files, are a common format for eBooks and online documentation. They are basically a collection of HTML files stored in a compressed archive with the added benefit of an index.

You first need to extract the original HTML files from the CHM archive. This can be done with the CHMLIB (CHM library) and its included helper application extract_chmLib.

sudo apt-get install libchm-bin

Convert .chm files in to HTML files

extract_chmLib book.chm outputdirectory

convert HTML  files in to PDF files

you need to install htmldoc. HTML processor that generates indexed HTML, PS, and PDF.HTMLDOC is a program for writing documentation in HTML and producing indexed HTML, PostScript, or PDF output (with tables of contents). It supports most HTML 3.2 and some HTML 4.0 syntax, as well as GIF, JPEG, and PNG images.

sudo apt-get install htmldoc

you can then run this application from the system menu or by typing

htmldoc

quickly print to PDF from every program application

If you are using either Mozilla Firefox or Konqueror you have a choice to directly save the webpage as PDF. However a more handy approach that could be used systemwide with every application is installing the cups-pdf virtual printer. With this approach every application capable of printing its contents can benefit from the export to PDF file features.

apt-get install cups-pdf

you can then use your system applet for managing printers in order to add the virtual printer systemwide.

Related posts:

  1. enable your native linux PDF printer
  2. batch resizing images
  3. convert ogv to avi
  4. AcetoneISO the Daemon Tools and UltraISO for linux
  5. PDF editing on linux
  6. How to professionally scan and OCR with open source tools
  7. Manual duplex printing on linux
| Print This Post Print This Post | Email This Post Email This Post
RSS 2.0 | Trackback | Comment

2 Responses to “Convert documents and images into PDF on linux”

  1. Luke says:

    Thanks for the tip. I have a few “ebooks” released as a zip full of htmls. And it’s handy to know you can do that with pics. I just have one question, when I can use .chms on any os why would I need to convert them to pdf?

    • aldeby says:

      Thanks for the feedback Luke! Actually this post is just for reference in case for whatever reason you were willing to convert your CHM into PDF. If you are ok with CHM there is no problem with that! :-D

Leave a Reply

XHTML: You can use these tags: b, cite, code, em, i, q cite="", strike, strong.