Skip to content
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_pages with page filter may leave cursor on incorrect page #1223

Open
pbhogan opened this issue Nov 3, 2021 · 0 comments
Open

number_pages with page filter may leave cursor on incorrect page #1223

pbhogan opened this issue Nov 3, 2021 · 0 comments

Comments

@pbhogan
Copy link

pbhogan commented Nov 3, 2021

I have a case where I'm generating a PDF that has repeating content including repeating page numbering for each instance of the content.

So, for example:

  1. Create PDF document
  2. Append 4 pages
  3. Call number_pages with a page_filter that excludes page 4.
  4. Repeat steps 2 and 3 several times.

What happens is the 4th page in each set gets overdrawn except in the final iteration. I believe this is because number_pages calls go_to_page internally, potentially leaving the cursor on a different page from when it was called. This is unintuitive.

I was able to fix it in my case by inserting a go_to_page after every number_pages that goes to the last page in the PDF.

I believe the fix is to make number_pages return the cursor to whatever page it was on before number_pages was called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant