- 1 year ago
How to load multiple html files by using wkhtmltopdf with other options in a batch file
Comment
1 / 1
To load multiple HTML files and apply additional options using wkhtmltopdf
in a batch file, you can follow these steps:
Create a new batch file:
- Open a text editor and create a new file with a
.bat
extension (e.g.,convert_html.bat
).
- Open a text editor and create a new file with a
Add the
wkhtmltopdf
command:- In the batch file, write the
wkhtmltopdf
command to convert the HTML files to PDF. - Specify the input HTML files and any additional options you want to use.
- Here's an example command that converts multiple HTML files to PDF:
Replacebatchwkhtmltopdf --option1 value1 --option2 value2 input1.html input2.html output.pdf
--option1 value1
and--option2 value2
with the desired options you want to apply.
Replaceinput1.html
,input2.html
with the actual paths or names of your input HTML files.
Replaceoutput.pdf
with the desired output PDF file name.
- In the batch file, write the
Save the batch file:
- Save the batch file with the desired name and
.bat
extension (e.g.,convert_html.bat
).
- Save the batch file with the desired name and
Execute the batch file:
- Open a command prompt.
- Navigate to the directory where the batch file is saved.
- Run the batch file by typing its name and pressing Enter.
- The
wkhtmltopdf
command will be executed, and the specified HTML files will be converted to PDF.
By following these steps, you can create a batch file that loads multiple HTML files using wkhtmltopdf
and applies additional options to generate PDF output. Customize the wkhtmltopdf
command in the batch file according to your specific requirements and file paths.