Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
15
rated 0 times [  15] [ 0]  / answers: 1 / hits: 7017  / 3 Years ago, mon, september 13, 2021, 6:03:48

I have a folder with this structure:



/main-folder
/index.html
/subfolder1
/index1.html
/file1.html


with many sub folder and only html files... i want to convert all them to pdf using only one command or a simple script that doesn't require all file names.



Do you know one


More From » pdf

 Answers
3

I would suggest installing the WKHtmlToPDF tool from http://wkhtmltopdf.org/ (moved from: http://code.google.com/p/wkhtmltopdf/).



You can then change to the root folder and use find and xargs to convert them:



cd /main-folder
find . -name *.html | sed 's/.html$//g' | xargs -n 1 --replace=X wkhtmltopdf X.html X.pdf


This will then build a PDF with each HTML file.


[#41440] Tuesday, September 14, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
nerta

Total Points: 414
Total Questions: 103
Total Answers: 97

Location: England
Member since Wed, Apr 19, 2023
1 Year ago
;