Write to PDF page after NextPage

I am creating a multipage PDF report and would like to update amounts on an earlier page. In short, I want to put a category name and a dollar amount on a line. The on indented lines below it, there would be name of sub-categories with dollar amounts. If there are enough sub-categories to need a second page, when I get to the end of the sub-categories, I want to go back and update the amount for the main category on the first page.

The PDFDocument has a CurrentPage property, but I can’t figure out how to reference its graphics property to be able to update it.

You should not go back, you should precalculate your needs and put them there once.

If you set the CurrentPage to a previous page, that will be the current Graphic context to draw into.

In this case, you should reserve space to write later content, instead of “updating” values.

1 Like

I tried Rick A’s suggestion of precalculating. Not only is it faster and less code, it provides all the data if the user chooses to download it as a text file.

1 Like