i managed to print some pages, header, footer positioned, i liked it,
almost felt it done.
then i wanted to extend my treeview class with a print capability,
but then i confronted with the fact, that i don’t know how many pages do
i need to print,
since i wanna have header, footer on the pages, and i don’t wanna miss
a character, so i set ellipsize to off and wrap to word,
but then i can’t estimate the height of my text lines,
so i have to lay the table to on the context so i can count the pages
and feed printoperation with it before printing, as it is in the docs.
i realized, i’m moving my code from draw_page event into paginate event.
and then i found that in paginate i have the context only of the first
while in draw_page i could use the context of all the pages one by one.
first i thought i’ll have to construct the print context for
printoperation in paginate and have only a cairo::context.stroke per
page in the draw_page event.
but that can’t be done.
so i concluded that i have to lay all my headers, footers, table
headers, some rows of table data on paginate’s context
only to count how many table rows i was able to lay, so clear the
context an continue the laying of pango stuff like it was a the next
and the end i get the number of my pages, and can start
printoperation.run, who will call draw_page and i can lay everything
again and stroke at the end.
but then it came to me, this has to be wrong, this is not how it’s
supposed to be.
so please, anyone, who has a clue about printing like this, point me to
the right direction.