nimpdf icon indicating copy to clipboard operation
nimpdf copied to clipboard

Only first page have content

Open bt0rne opened this issue 1 year ago • 3 comments

When trying to write text or content to any pages in a document after page 1, the pages turn out blank. I tried compiling the "pagelabels.nim" example file as well, having the same problem. The labels work as expected.

Using Nim 2.0.0 and nimPDF 0.4.3.

I have tried compiling the code on multiple computers, both running Debian 12, and tried opening the PDF's with both zathura and Brave.

Screenshot of zathura, PDF exported with pagelabels.nim:

1 2

bt0rne avatar Dec 19 '23 20:12 bt0rne

You can see the raw output in the demo/ folder: https://github.com/jangko/nimpdf/blob/master/demo/pagelabels.pdf

Try with this to write text on specific pages: https://github.com/jangko/nimpdf/blob/master/demo/change_page.nim

ThomasTJdev avatar Dec 19 '23 20:12 ThomasTJdev

Oh i see now that it's empty there aswell. I find it weird considering drawText() is used on the other pages aswell?

change_page.nim compiled without errors, so i'll change some of my code and give an update when i have tried it.

bt0rne avatar Dec 19 '23 20:12 bt0rne

I located the issue now. I didn't set a font after adding a new page, only after adding the first page with doc.setFont(...).

It seems a bit counter intuitive having to specify the font for the doc variable each time after adding a page, but making a new proc with addPage() as well as setFont() works fine though.

Thanks for the quick reply!

bt0rne avatar Dec 19 '23 20:12 bt0rne