Printer queue not clearing?

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
tibtec
Posts: 6
Joined: Sun Mar 30 2003

Printer queue not clearing?

Post by tibtec »

We are using the developer version of the PDF Converter.

As such, we are using PDDriverInit and then EnablePrinter with the company and activation key just prior to printing.

When finished printing, we are setting the SetFilenameOptions back to zero and calling driverend.

We are finding that the converter is not clearing the previous print from its queue (?) in that if you print document X and then a few minutes later you print document Y, it will print document X a second time, rather than printing document Y. If you then print a third document, it will come out as document Y, etc.

The HTML document we are generating from which we are doing the conversion is indeed the correct document each time, so the problem is with the converter clearing itself out and printing the successive document.

Have you seen this before? Any suggestions?
tibtec
Posts: 6
Joined: Sun Mar 30 2003

Post by tibtec »

I should probably note that we are doing all of this from code within our VB6 app.
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

If you are printing in multithreading environment, please use the locking mechanism of CDintfEx.

I am including here a pseudocode on using the locking mechanism. Also please feel free to download any of our technical notes from: http://www.amyuni.com/en/support/technotes.html


*********************************************************
In version 2 of the PDF Converter, under NT and above we can have multiple jobs printing at the same time. You don't need to wait for one job to end before starting the next one. You can use the Lock capabilities of CDINTF to print multiple jobs at the same time. The lock works as follows:

1 - To lock the job:

cdintf.Lock( documentTitle );

the document title is what appears in the printer spooler when a document is printed,

Ex: for Excel object, it’s the Workbook.Name.


2 - To set the output file name:

cdintf. SetDocFileProps(documentTitle, fileNameOptions, fileDir, fileName);

or to email the document:

cdintf.SetDocEmailProps(documentTitle, To, CC, BCC, Subject, Message, Prompt)

3 - Do the printing

4 - To unlock:

cdintf.Unlock( documentTitle, timeout );

It waits for the print job to finish or the timeout event whichever comes first and then unlocks the job.

This does not mean that each job has to wait for the previous one, as soon as the printing starts, information is retrieved from the registry and the next job can start before the first one ends. The call to cdintf.Unlock is only there in case there is an error during printing and the printer did not correctly unlock.

You need to know the document title as it appears in the print spooler to be able to use this method.

*************************************************************

Hope this helps 8)
tibtec
Posts: 6
Joined: Sun Mar 30 2003

Post by tibtec »

Thanks. I've tried doing as you suggested...that seems to make a lot of sense.

However, when I switch from using the defaultfilename, and options to the lock and setdocoptions, etc., then I seem to be unable to print at all!

All of the functions I am calling seem to be working properly and are not getting any errors, but nothing at all is printing, just getting hung at the time of printing and nothing happens.

I should also mention that everything works perfectly when running this from the project itself. It is only once it is compiled into an .exe and run from the .exe that it exhibits this behaviour where it prints the same document the second time around as it did the first time, and the second document prints the third time you try to print, etc.

Any other thoughts?
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

What are you specifying as DocumentTitle? Is it the same name as the print job?

Are you running the exe on the same machine?

Thanks.
tibtec
Posts: 6
Joined: Sun Mar 30 2003

...

Post by tibtec »

I am setting document title to whatever the name of the target document is....so if it is going to be AAA.pdf then the document title is AAA.

I am using the PDF converter installed on the machine where I'm running the exe from.
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

Please send a sample application to support@amyuni.com we will check it and see what is happening.

Thanks.
Post Reply