-
Notifications
You must be signed in to change notification settings - Fork 227
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
Number of pages appears to not function correctly #71
Comments
Your snippet does include how to initialize & use your custom class. Could you please provide code that is directly usable to reproduce your issue ? |
You are correct. I tried to strip things a bit to the bone and ended up making my example un-runnable. My bad. I have updated the snipped to represent a minimal example. Thank you for your assistance, j |
When you say "it works", that looks exactly like it doesn't work. I'm expecting to see "Page 1 of 1". |
This is the text string used in the This is where your issue comes from. Try this instead: self.cell(0, 10, f'Page {self.page_no()} of {len(self.pages)}', 0, 0, 'C') |
The workaround I mentioned above should work for you, I'm going to take a look at it soon in order to replicate the original functionality. Thank you for reporting this! |
Perfect workaround. Thank you! I don't want to hit "close" b/c it appears that you are tracking this as a bug, but feel free to close when you feel that the issue is resolved. |
Thanks. This will be automatically closed when #72 will be merged. Also, a side note: I noticed your "trick" to avoid f-string substitution of the |
I agree. I had initially done that, but in my attempts to correct the issue, I tried a few things. I prefer f-strings, but I was at my wit's end. |
Closed by #72 |
Hi Lucas, I am speaking from Globaleaks. I am having an issue with the footer: I have a lot of custom fonts. All work perfectly while generating the PDF, but {{nb}} doesn't get replaced if I use custom fonts and is printed as 1/{nb}. However, if I use your default fonts like Courier, it works as expected, replacing {nb} with total pages. strange thing is while using custom fonts font of 1/{nb} is also changed its just that the {nb} is not replaced with total page |
It is a known issue, reported on #1090 because text shaping with render the {nb} differently with some fonts depending specially on kerning. I am going to work on this issue soon and we will hopefully have a final solution before the next release. In the meantime I can suggest 2 workarounds:
|
Thank you @andersonhc , we have solved using 'courier' for the header and footers actually works for us since it adds a nice touch to result we need in @globaleaks. This is actually the issue i was encountering with @msmannan00 while working on #1175 (comment) |
This worked in
fpdf
.I have an object that I created called
_Report
that subclassesfpdf
:I have tried several items for that last line in the
footer
to no avail. I have also tried to move theself.alias_nb_pages()
to a couple of different locations, but it always prints "{nb}" on to the PDF.The text was updated successfully, but these errors were encountered: