How can I convert many HTML into PDF files at once?
-
By printing an HTML file I mean printing the output, not the HTML source code. I want to have one PDF file per HTML file.
-
Answer:
You can use https://code.google.com/p/wkhtmltopdf/: (it works with Windows, Linux and Mac OS X) Description Simple shell utility to convert html to pdf using the webkit rendering engine, and qt. Introduction Searching the web, I have found several command line tools that allow you to convert a HTML-document to a PDF-document, however they all seem to use their own, and rather incomplete rendering engine, resulting in poor quality. Recently QT 4.4 was released with a WebKit widget (WebKit is the engine of Apples Safari, which is a fork of the KDE KHtml), and making a good tool became very easy. Examples: Portrait: wkhtmltopdf http://francky.me myhomepage.pdf Landscape: wkhtmltopdf -O Landscape http://francky.me myhomepagePortrait.pdf
Franck Dernoncourt at Quora Visit the source
Other answers
Acrobat's own WebCapture can convert whole sites to PDF; you may get one single PDF, which you then can split into indivicual pages. For industrial strength conversions, you might talk to the people of PDF-Tools, for example. However, if you have full control over the document creation process, you may get better results by skipping the HTML and go directly from the original document/output to PDF.
Max Wyss
Note: This method works only for one HTML file at a time. Open the file in a browser e.g. Google Chrome, and hit [Ctrl+P]. A window like this should appear : The destination file type is not defaulted to PDF but you can customize it yourself as I did here. Click save and choose the destination.
Anonymous
If you have many HTML files and don't want to install and program wkhtmltopdf, consider using a hosted API such as http://docraptor.com/. wkhtmltopdf is based on the WebKit browser engine and is great for translating websites into PDFs. However, if you're writing custom HTML designed to be printed, DocRaptor has a number of print-specific features such as support for CSS @Page queries. Note: I work for DocRaptor.
James Paden
I agree with Franck - if you install wkhtmltopdf you can then run the following on the command line (for Linux/Mac OS X) cd /main-folderĀ find . -name \*.html | sed 's/.html$//g' | xargs -I X -n 1 wkhtmltopdf X.html X.pdf and that'll go through our files one by one converting them (without removing them)
Piers Young
Related Q & A:
- How can I do a resource in PDF file?Best solution by Stack Overflow
- How can I split an HTML element?Best solution by Stack Overflow
- How can I convert real player audio files into mp3?Best solution by Yahoo! Answers
- How can I add a HTML code to My Yahoo homepage?Best solution by Yahoo! Answers
- How can I convert PDF files into JPG?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.