I am working on a project that converts numerous document types (xml, word, xls, jpg, png, html, ...) to PDF, and concatenates them all into one document. The order that these documents are to be concatenated is chosen before the conversion takes place, yet upon conversion, the order is not always preserved, and sometimes entire document sections are missing.
I believe the issue has something to do with timing. If all of the documents are relatively smalle (~1page), probably rarely occur. However, when I start exporting with larger documents is when I run into problems. For example, if a 7 page document is being followed by a 1 page document, sometimes the 1 page document will appear before the 7 page, other times the 7 page document will not display at all. It is like the 7 page doc gets spooled, but before it is fully written to the PDF, the 1 page document supercedes it and is written.
We are capturing events from the CDIntfEx control. On StartDocPre we set a blnPrinting flag to true. Then we print the document, and go to a loop like the following:
While blnPrinting
Wait 50
DoEvents
Wend
As soon as EndDocPost is raised, blnPrinting is set to false, and we jump out of this loop. It seems that FinishedPrinting doesn't work properly though. It appears that it is being raised before the document is actually done printing. Following KB202480 http://support.microsoft.com/default.as ... -us;202480, I've setup a call that returns a printer status and it's job status.
Numerous times, after FinishedPrinting is called, the printer still has the job in its queue. How can this be?
Do you have any advice on this problem? I've spent days trying to debug this, and am running into a brick wall at this point.
Timing problems when converting/concatenating many docs
-
- Posts: 2
- Joined: Wed Jul 27 2005