Open hsluoyz opened 3 years ago
Track each time you call gopdf.AddPage(). That's what I do.
@hsluoyz you could use GetNumberOfPages
now.. :)
https://github.com/signintech/gopdf/pull/165
But how to get the page count of a PDF file.
If we import the PDF: https://github.com/signintech/gopdf#import-existing-pdf , how to import all the pages of that PDF? In gopdf we don't know the page count, so the for loop has no ending condition.
For example, create PDF file B, import all the pages from PDF file A to B (with some modifications like adding footer). There's no easy way to get the page count of A, but for importing pages, you have to know the page index of A.
Another way is to return error in UseImportedTemplate()
when the page index is out of page count, but it doesn't.
Ah.. okay.. I misunderstood your question. Previously I use a c-go library for importing another pdf (as images) to be used in Gopdf due to this limitation also.
@oneplus1000 can you close this issue if it has been resolved?
Is there an easy way to get the number of pages?