-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
Is there a way to get the current page number during pdf generation? #461
Comments
you can manually count those when you add content as per |
The suggestion of using |
ur correct. i'd have to calculate how many line items will fit on a page and call page.New() myself. It would be nice to be able to register a callback on overflow to a new page. |
It would indeed, but there is no such option so far:) |
Great idea about the callback. My tests indicate that on a Letter page without header and a simpler footer you can fit 244 row units. Now, I reached a dead end here because the Row Height (which is for obvious reasons not part of Twitter Bootstrap) is way too limiting requiring much guess work, and the inability to plainly feed a paragraph and no means of calculating the necessary row height. I spent too many weeks thinking Maroto/V2 was THE solution. I saw myself in need of dumping all these weeks' work in favor of GoDocx which doesn't impose these unnecessary restrictions. It is not PDF but you can always print to PDF. I hope there is some rethinking of this library so that it becomes viable for documents and not just premade forms. |
Hello, about the automatic calculation of row height, I recently started working on this feature, it is not finished yet, however for the text component it is already working, if you can take a look and say if it is what you expected, it will be of great help! feature I think the idea of being able to register a function as a callback is great, I can add this feature! |
Great... Will be looking for it... The power of the callback will be; when its called and what can be altered (header/footer) etc... I am working on a some-what involved workaround. i have a situation where i'm generating an invoice. If this "special" line_item appears i need to add some "xtra text" on that page above the footer. To attempt this i have 2 ideas.
|
I cannot try it out because it has not made it out into neither 2.08 nor 2.0.9. What you write indicates it works fine for the text component. At this moment all I need is that it works for text, I need to feed paragraphs without having to bother about row height. Any timeline when this change is going to make it to the main branch? else I forget about this forever and use godocx instead. I wanted to use PDF in several pet projects but if it isn't going to work then I might as well move forward with an alternative. |
Is your feature request related to a problem? Please describe.
This feature is not related to a bug. But would help solve the below problem.
Describe the solution you'd like
While generating rows i want to be able to print a unique row on the first page but not any other. Also have the need to print extra information on only the last page.
Also need to alter headings and footers per page or based on page content (a certain description appears in footer if a unique line item appears on that page).
Describe alternatives you've considered
I assume that the heading code is executed for each page. Thought about a counter in the headings code.
Additional context
The text was updated successfully, but these errors were encountered: