Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

Can we create one long PDF page #4299

Open
beshoo opened this issue Mar 22, 2019 · 4 comments
Open

Can we create one long PDF page #4299

beshoo opened this issue Mar 22, 2019 · 4 comments

Comments

@beshoo
Copy link

beshoo commented Mar 22, 2019

Can we do that? So there is no page breaking!

@PhilterPaper
Copy link

PhilterPaper commented Mar 23, 2019

This has been asked a number of times before. Why start a new thread?

Just a quick look shows #1627, #1841, #3058, #3208, #3404, #4304

@beshoo
Copy link
Author

beshoo commented Mar 30, 2019

@PhilterPaper I know, I am a developer and I know the rules.
Show me One post talking about working howto!

I tried to convert the website to images, then take the image hight then convert it to mm by
PIX * 0.264583333.

and use --page-hight , the problem that i got very long PDF page which means wkhtmltopdf add some extra spaces.

I need a working solution which provides a clean PDF and 100%$ fit the page content.
All #1627, #1841, #3058, #3208, #3404, #4304 ar tlaking about the hope of having auto size.

Please advice

@PhilterPaper
Copy link

PhilterPaper commented Mar 31, 2019

It's been asked many times, but as far as I can tell, no one has ever delivered a foolproof solution. I think the closest anyone has come is to specify a ridiculously long page size (of whatever width you desire), and if the result fits on it, use some utility to trim it down to minimum size. Otherwise, double the page height and try again.

Add: One possible C++ code fix would be to output the entire thing to a single standard (A4 or Letter) page, close the output PDF, read it in again, find the most negative "y" value, and add (absolute value) to all "y" values. Maybe it could be done before the PDF is output the first time (does it hold the entire page in memory?), which may bypass any problem with stream lengths changing in the process. Yes, a lot of work. Or, make a dummy first pass which merely finds the most negative "y", and add the offset on the real second pass. Still kludgy, but this is a major architectural change no matter what you do. Or even just change the code to write one page with huge negative "y" values, otherwise in the normal manner, then a new utility looks through the PDF for the most negative "y" and reruns wkHTMLtoPDF with adjusted page height on the command line. All sorts of possibilities.

@st68
Copy link

st68 commented May 13, 2020

From --help:

Page Breaking
The current page breaking algorithm of WebKit leaves much to be desired. Basi‐
cally webkit will render everything into one long page, and then cut it up
into pages.

...can webkit be instructed to NOT cut it up?

my version: wkhtmltopdf 0.12.4 (with patched qt)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants