Could not start print job

If you are a VB developer and have questions about using our products from VB, here is the place to post them.
Post Reply
cm_ph
Posts: 4
Joined: Thu Jul 28 2005

Could not start print job

Post by cm_ph » Thu Jul 28 2005

Hello all,

We use Amyuni version 2.10 to print PDF documents. We recently commented out lines 3 & 5 in the below code because some users were having issues with printing to PDF that would crash our Visual Basic 6.0 application during line 4 below. The default printer steps were commented out so that when they printed using another application it would succeed using their real default printer and not try to send it through Amyuni to PDF after the line 4 crash.

Code: Select all

1) Set l_pPDFPrinter = CreateObject("CDIntfEx.CDIntfEx")
2) 'Do some initialization stuff for the printer
3) l_pPDFPrinter.SetDefaultPrinter
4) 'Do some stuff and print the document
5) l_pPDFPrinter.RestoreDefaultPrinter
This brings me to my problem. After commenting out lines 3 and 5 users that have a local printer as their default installed on LTP1 could not use the Amyuni printer any longer and receive the, "Could not start print job" error. Conversely, users that have a network printer as their default have no problems and continue to print as they did before. Our quick fix is to set all users to have a default network printer but this is quite frustrating for users who prefer to use a local printer as their default.

So, now my question. Is it possible to use Amyuni with a local printer as your default printer and not have to programmatically set the Amyuni printer to the default before printing each time?

Thanks so much for your time and assistance,
Cory

Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan » Mon Aug 01 2005

Hello,

This issue depends on wether your application tries to print the documents to the default printer on the system or to a specific printer.

To overcome this issue without having to call SetDefaultPrinter, you need to check if you can print your reports to a specific printer (and not to the default printer).

I am not sure what you are trying to print, whether repords or Windows documents but in general, when designing a report or when printing a Word document by example you can choose either to print that report to the default printer of the system or to a specific printer.

Setting the printout to be directed to a specific printer that is the PDF Printer will resolve this issue without setting the PDF Printer as default.

Hope this helps.

cm_ph
Posts: 4
Joined: Thu Jul 28 2005

Post by cm_ph » Mon Aug 01 2005

Joan,

Thank you for your reply. I wavered on whether or not to include all of the code for the document printing or what I included to be to shorter and to the point but now I know that I should have provided more details.

Below are the revised steps to clarify that we are indeed printing to the Amyuni specific printer. In steps 4.c and 4.f I refer to using a 3rd party control that is placed on a standard VB form that we use for document/report information. We purchased this document software from the Scansoft company (http://www.scansoft.com/omniform/). In steps 4.d I refer to an actual instance of the OmniForm document control that is our company specific document that we need to convert into PDF format.

Code: Select all

1) Set l_pPDFPrinter = CreateObject("CDIntfEx.CDIntfEx") 
2) 'Do some initialization stuff for the printer
     a) Call l_pPDFPrinter.DriverInit and provide the Amyuni/PDF printer name
     b) Set the l_pPDFPrinter.DefaultDirectory
     c) Set the l_pPDFPrinter.DefaultFileName
3) l_pPDFPrinter.SetDefaultPrinter 
4) 'Do some stuff and print the document 
     a) Set l_pPDFPrinter.FileNameOptions = 1 Or 2 (noprompt + usefilename)
     b) Call l_pPDFPrinter.EnablePrinter and provide our company name and serial number string
     c) Call ActivePrinter on the OmniForm document control and provide the Amyuni/PDF printer name
     d) Call PrintForm on our active OmniForm document to send it to the Amyuni/PDF printer
     e) Use a loop and Windows API calls to wait for the printing to complete
     f) Call ActivePrinter on the OmniForm document control to restore the printer to their default
5) l_pPDFPrinter.RestoreDefaultPrinter
6) Set l_pPDFPrinter.FileNameOptions = 0
7) Call l_pPDFPrinter.DriverEnd
8) Set l_pPDFPrinter = Nothing
Now that the entire PDF conversion code is revealed and reminding you that we commented out steps 3 and 5 I will pose my question again.

Is it possible to use Amyuni with a local printer as your default printer and not have to programmatically set the Amyuni printer to the default before printing each time?

Thanks so much for your time and assistance,
Cory

Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan » Fri Aug 05 2005

Hello,

The answer to your question is Yes, this is the recommanded way of using the PDF Converter.

Please try the same procedure with another local printer and see if
you succeed in printing to it.

Thanks

cm_ph
Posts: 4
Joined: Thu Jul 28 2005

Post by cm_ph » Fri Aug 05 2005

Joan,

Thanks for your reply again.

We have tried the exact same code and process on about 10 machines. Two of the ten have local printers and they both do not print to the Amyuni PDF converter with the local printer set as the default. Only the other 8 machines can use the PDF converter because they have a network printer set as the default. Similarly, the 2 computers with the local printers will also print successfully to the PDF converter when a network printer is set as the default.

I believe that I am being as clear as I can possibly be and fear that this post is becomming redundent since I am restating my problem in another way. Regardless, I hope that this clarifies the issue and allows someone to post a solution or answer that I can take action upon.

So, now I need to know if there is something special that should be done to either the local printer that is set as the default or the Amyuni printer setup to make this work since you stated that this is the recommended way of using the PDF converter? I have tried changing the printer port from LPT1 to LPT2 for both the local printer and Amyuni printer but this did not resolve my error.

Thanks everyone,
Cory

cm_ph
Posts: 4
Joined: Thu Jul 28 2005

Post by cm_ph » Thu Sep 15 2005

Thank you to those who read about my issue and provided your advise. We found that the problem was caused by the printer driver that was selected for the local printer. However, between PC's (despite the same OS version/patchs and nearly identical hardware) some drivers worked on one PC but not the other. Hmmm.....

I found that the 'HP Laser Jet 4050 Series PCL 5e' driver works on all PC's and printers that we tested and resolved my issue.

Thanks to Amyuni for a solid product that works properly when the configuration is done correctly.

Have a Great Day!

Post Reply