Ask Your Question
0

How can I ensure that the output of Wkhtmltopdf is adjusted to fit the full width of the page?

asked 2022-06-19 11:00:00 +0000

devzero gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-04-18 02:00:00 +0000

lalupa gravatar image

You can use the --page-width and --page-height options to set the width and height of the page, respectively. To ensure that the output fits the full width of the page, you should set the page width to be the same as the width of the content in your HTML file. For example, if your content is 800px wide, you can use the following command:

wkhtmltopdf --page-width 800px input.html output.pdf

You can also use the --zoom option to adjust the scale of the output. For example, if you want the output to be 90% of the original size, you can use the following command:

wkhtmltopdf --zoom 0.9 input.html output.pdf

Note that the --zoom option may affect the quality of the output, so you may need to experiment with different values to find the optimal setting.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-06-19 11:00:00 +0000

Seen: 7 times

Last updated: Apr 18 '22