I’ve added the Area::next_layer on the master branch, so feel free to submit a patch for this feature.
~ireas (and ~ap4sc) would it be ok if I did this?
Comment by ~ireas on ~ireas/genpdf-rs
I can print a header, but I cannot find how to print a footer.
It is not supported by
SimplePageDecorator
at the moment because you have to specify the position of the top-left corner of an element before rendering it. As you cannot determine the height of an element without rendering it, it is hard to do that for a footer with generic elements.But if you use a fixed height for the footer, you can create your own
PageDecorator
implementation that uses the fixed height to calculate the position of the element before rendering it.In the long-term, the
Element
trait should be extended to provide a size estimate without rendering the element. Then we could add a genericadd_footer
method toSimplePageDecorator
.
Comment by ~ireas on ~ireas/genpdf-rs
Potentially, for very simple graphs,
Area::draw_line
could be used. But other than that, it is currently not possible to do it only with genpdf.
On 10/12/22 14:11, ~ireas wrote:
Adding page numbers is already possible as demonstrated in the
demo
example (PDF). Adding the total page number would be nice but pretty hard to implement with the current rendering process.I can print a header, but I cannot find how to print a footer.
-- Carlo Milanesi
On 10/12/22 14:08, ~ireas wrote:
This would be a very nice feature. According to its readme,
printpdf
(that is used internally bygenpdf
) does not support SVG yet, but there is aSvg
struct that looks like it could work.#I am writing a book for Manning. It will describe Genpdf, but it will not not describe Printpdf. I don't have time to discover how to insert a non-documented Printpdf object inside a Genpdf document. So, I am going to write that Genpdf cannot create documents containing charts.
Carlo Milanesi
Comment by ~ireas on ~ireas/genpdf-rs
Adding page numbers is already possible as demonstrated in the
demo
example (PDF). Adding the total page number would be nice but pretty hard to implement with the current rendering process.
Comment by ~ireas on ~ireas/genpdf-rs
This would be a very nice feature. According to its readme,
printpdf
(that is used internally bygenpdf
) does not support SVG yet, but there is aSvg
struct that looks like it could work.
Comment by ~ireas on ~ireas/genpdf-rs
The main point where you want to use it is the
Element::render
method. Maybe this section in the docs or looking at the implementation ofElement
for e. g.Text
helps?