wcPdfDocument - closing and opening a new document

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Pat Verner
Earned a small fee
Earned a small fee
Posts: 16
Joined: Mon Sep 06, 2010 6:58 am

wcPdfDocument - closing and opening a new document

Postby Pat Verner » Wed Mar 27, 2013 5:24 pm

Hi there
I am running through a database, generating pre-completed application forms for a number of clubs. When I reach a new club, I want to close the current document, and open a new one.
Although SaveAsPdf() will "close" the file and save it, the next file generated contains everything from the first club and the second club, and so on. The 5th club contains pages from 5 clubs!
I have tried adding a Close() in the loop, makes no difference...
Is there any way to clear the old data in the file before continuing with the new file?

Regards
=Pat

utelle
Moderator
Moderator
Posts: 767
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wcPdfDocument - closing and opening a new document

Postby utelle » Wed Apr 03, 2013 8:17 pm

Pat Verner wrote:I am running through a database, generating pre-completed application forms for a number of clubs. When I reach a new club, I want to close the current document, and open a new one.
Although SaveAsPdf() will "close" the file and save it, the next file generated contains everything from the first club and the second club, and so on. The 5th club contains pages from 5 clubs!
I have tried adding a Close() in the loop, makes no difference...

Instances of wxPdfDocument are not meant to be reused for generating a new separate PDF document.

Pat Verner wrote:Is there any way to clear the old data in the file before continuing with the new file?

Yes, just instantiate a new wxPdfDocument object for each club.

Regards,

Ulrich

Pat Verner
Earned a small fee
Earned a small fee
Posts: 16
Joined: Mon Sep 06, 2010 6:58 am

Re: wcPdfDocument - closing and opening a new document

Postby Pat Verner » Thu Apr 04, 2013 5:06 am

Thanks.
=Pat


Return to “wxCode”

Who is online

Users browsing this forum: dkaip and 3 guests