{"id":359,"date":"2008-11-20T21:04:55","date_gmt":"2008-11-20T19:04:55","guid":{"rendered":"http:\/\/mattiesworld.gotdns.org\/weblog\/2008\/11\/20\/converting-multiple-images-into-a-pdf-on-linux\/"},"modified":"2012-03-14T00:04:08","modified_gmt":"2012-03-13T22:04:08","slug":"converting-multiple-images-into-a-pdf-on-linux","status":"publish","type":"post","link":"https:\/\/mattiesworld.gotdns.org\/weblog\/2008\/11\/20\/converting-multiple-images-into-a-pdf-on-linux\/","title":{"rendered":"Converting multiple images into a pdf on linux"},"content":{"rendered":"<blockquote><p><strong>Update 2012-03-13<\/strong><br \/>\nI don&#8217;t know if it was possible back in 2008, but nowadays you can simply use the convert command provided by imagemagick!<\/p>\n<p><code>convert image1.jpg image2.jpg output.pdf<\/code><\/p><\/blockquote>\n<p>Normally, when I need to create a PDF, I can print to the PDF printer included with KDE. However, on my suse box, this only seems to work out of the box with KDE apps. Also, since I need to combine multiple images into a pdf, it is a bit cumbersome to use a PDF printer here.<\/p>\n<p>I didn&#8217;t find a one-step solution, so here is how I did it:<\/p>\n<ol>\n<li>convert each image to a pdf<\/li>\n<li>merge all pdfs into one pdf file<\/li>\n<\/ol>\n<p>For the first step I used <a href=\"http:\/\/bmeps.sourceforge.net\/\">bmeps<\/a>, a tool which I recently discovered by accident \ud83d\ude42 It is strange, when searching for the tool, I didn&#8217;t find it. So that&#8217;s why I give it some extra promo on my blog. \ud83d\ude09 Bmeps is a cross platform tool (yes, I already once used it succesfully on windows!). It used to be a (E)PS tool, but since version 2.0 it also supports PDF output (up to PDF version 1.4). As input, it accepts JPEG, netpbm and PNG (and TIFF partially).<\/p>\n<p>As Bmeps doesn&#8217;t seem too popular, I wasn&#8217;t too surprised to learn my distro doesn&#8217;t have any package for it, so I had to build it from source. Bmeps has a dependency on <a href=\"http:\/\/dklibs.sourceforge.net\/\">dklibs<\/a>, a collection from the same author which also needs to be compiled. But it turned out to be a pleasant experience: all prerequisites were already satisfied on my computer (except netpbm, but I don&#8217;t need that) and I just had to run the familiar &#8220;configure make install&#8221; (once for dklibs and once for bmeps of course).<\/p>\n<p>After that, converting an image to a pdf is as simple as:<\/p>\n<p><code>bmeps image.jpg image.pdf<\/code><\/p>\n<p>Now we have a bunch of pdf files, we still need to merge them. For that I chose the quite popular <a href=\"http:\/\/www.accesspdf.com\/pdftk\/\">pdftk<\/a>. It wasn&#8217;t installed by default, but there does exist a package in the suse main repositories, so that was easy. Now, to combine all pdfs into one:<\/p>\n<p><code>pdftk input*.pdf cat output output.pdf<\/code><\/p>\n<p>And that&#8217;s it!<\/p>\n<p><small>PS: there used to be a tool <a href=\"http:\/\/png2pdf.sourceforge.net\/\">png2pdf<\/a> from the same author for people wanting to convert PNG files, but this has been superseded by bmeps.<\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update 2012-03-13 I don&#8217;t know if it was possible back in 2008, but nowadays you can simply use the convert command provided by imagemagick! convert image1.jpg image2.jpg output.pdf Normally, when I need to create a PDF, I can print to the PDF printer included with KDE. However, on my suse box, this only seems to &hellip; <a href=\"https:\/\/mattiesworld.gotdns.org\/weblog\/2008\/11\/20\/converting-multiple-images-into-a-pdf-on-linux\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Converting multiple images into a pdf on linux<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,6],"tags":[],"class_list":["post-359","post","type-post","status-publish","format-standard","hentry","category-linux","category-software"],"_links":{"self":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/posts\/359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/comments?post=359"}],"version-history":[{"count":3,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/posts\/359\/revisions"}],"predecessor-version":[{"id":547,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/posts\/359\/revisions\/547"}],"wp:attachment":[{"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/media?parent=359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/categories?post=359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mattiesworld.gotdns.org\/weblog\/wp-json\/wp\/v2\/tags?post=359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}