Printing without printing the extra page?

Hi Folks,

I been getting feedback from users about one of my tools always printing a blank page after the actual content pages are completed (regardless of the number of pages).

I always use a Graphics.NextPage call at the end of each page - including the last page, and it appears that this is the cause. However, removing the last NextPage call results in the document not actually printing. It cues up, but the document never comes out of the printer (tested on multiple printers).

How can I print a Graphics item to print such that all of the content is printed without the blank final page?


Test to see if you’re on the last page before calling NextPage?
On my phone sorry for the short response.

Thanks, Tim.

I’ve tried that and it’s what I was talking about when I mentioned removing the last p.NextPage and the document never printing.

instead of using graphics.nextPage on the last page, just set graphics = nil. This will start the printing without adding a new page.

Are you setting p = nil when you’re done? Or just letting it go out of scope? I’ve had trouble getting a job to not print, but never had a problem with it stalling.

Make sure you end on the right page. Basically, keep in mind that the last page shouldn’t be calling Graphics.NextPage since the Graphics object will automatically print it for you when it goes out of scope.

Alain and Tim H - that was the problem :O. I was not setting P to Nil, so it never went out of scope until the app exits. Setting p = Nil if I’m on the last page fixed it.

And look, a legacy application just got an update. Customers love updates, even if nothing real important has changed.

Yes. Yes they do :stuck_out_tongue:

(Norman got it :slight_smile: )