-
-
Notifications
You must be signed in to change notification settings - Fork 660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Page break report #1894
Comments
Hi!
I think that it’s a duplicate of #1252, isn’t it? |
The issue I described would be solved if the behaviour in #1252 were implemented. However I described a more general solution that will enable the users to control page breaking in detail (at least the programmers user). I do not know how much is complex to implement, but my tests with the H4 trick suggest to me that all what is needed is already in place. |
WeasyPrint tries to follow the specifications, so we can try to add such a behaviour if it’s in the specification. Is your idea to get all the different break points with the Python API? |
Which specification? I am proposing a way to get the list of the breaks added by WeasyPrint to a specific document, I do not think this can be covered by the html/css specification.
My idea was a command line flag, but yes, a python API would be enough for me since I can write a simple command line wrap. Is it already possible to do something like that? The most close thing I found was the one I described as workaround. |
The specification describing break points (linked in my comment).
If it’s a workaround to solve your original problem, then it would be better to solve #1252. For a more general case, and as a workaround for now, if you want to know where your document was split with the API then you can add ids to your HTML document and use the |
If I understand correctly, the page.anchor trick is similar to the one presented on my first post. I can continue to use it, sure. And yes, fixing #1252 would be helpfull in a lot of situation, but with 2) I was proposing a general way to handle page breaks programmatically. I understand the confusion, so please close this issue. I will open a new one in case I found another situation in which I need a more powerful control on page breaks. |
Yes, it is.
OK! |
I would like to add a page break before a specific element, if both the following conditions are true:
Probably this is a too specific feature, so I would ask:
The 2) can be also something very simple and "Passive" like a --report-breaks flag that return a list of where the page breaks will be placed. For my scenario this would be enough since I can write a script/program that call WeasyPrint multiple times, adding iteratively some page breaks until it gets the desired result.
What this "List of page breaks" actually contains is an open point; anything related to the position in the input HTML would work for me.
Currently I am experimenting with this workaround:
<h4>possible-break-uid</h4>
before each div/p/etcposition: absolute; left: -999px;
style for<h4>
to effectively hide them, but keeping weasyprint to generate metadata about themweasyprint.HTML().render()
<h4>
of each pagebut obviously an integrated solution would be a lot more usable.
.
The text was updated successfully, but these errors were encountered: