You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you call .render() on an HTML object, you get a Document object whose .pages attribute is a list of Page objects. You can shuffle this list all you want before calling e.g. .write_pdf() on the document, without modifying the layout code. I suppose you could use the pages’ anchors attribute to check which page contains a given element, if you give it an ID: e.g. <h2 id=toc> and if 'toc' in page.anchors: ...
So yeah, I suppose we could add limited support for target-counter() that only works if the target is earlier in the document, then you could have a TOC at the end and shuffle pages to put it at the beginning again. I guess you’d want something like @page :first { counter-reset: page 2 }, not sure if that works right now. Maybe named pages (#57) would be useful there as well.
This sounds reasonable. It’s just a matter of someone doing the work now. Unfortunately nobody is actively working on WeasyPrint at the moment.
If you call
.render()
on anHTML
object, you get aDocument
object whose.pages
attribute is a list ofPage
objects. You can shuffle this list all you want before calling e.g..write_pdf()
on the document, without modifying the layout code. I suppose you could use the pages’anchors
attribute to check which page contains a given element, if you give it an ID: e.g.<h2 id=toc>
andif 'toc' in page.anchors: ...
See details in the documentation: http://weasyprint.org/docs/api/
So yeah, I suppose we could add limited support for
target-counter()
that only works if the target is earlier in the document, then you could have a TOC at the end and shuffle pages to put it at the beginning again. I guess you’d want something like@page :first { counter-reset: page 2 }
, not sure if that works right now. Maybe named pages (#57) would be useful there as well.This sounds reasonable. It’s just a matter of someone doing the work now. Unfortunately nobody is actively working on WeasyPrint at the moment.
Originally posted by @SimonSapin in #23 (comment)
if 'toc' in page.anchors: ...
is doing weird behavior, putting some random values in that particular element.i want to achieve something like this
The text was updated successfully, but these errors were encountered: