Device not ready

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
nbnelson
Posts: 11
Joined: Thu Nov 13 2003

Device not ready

Post by nbnelson »

Hi,
I have followed the steps for deployment of the PDF Converter for developers. So far I have completed step 1, step 2 (using PDFDriverInit), step 3 (I should just be able to add the CDINTF.DLL through InstallShield), step 5 (my new printer object which is displayed in the list of printers in my application) step 6 (set DefaultFileName, SetFileNameOptions, etc.)

Now when i get to the line of code that calls PrintDocument.Print(), i get an error stating "The device is not ready".

Does anyone have any idea what might be causing this error? Any help would be greatly appreciated.

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

Post by Joan »

Are you calling EnablePrinter before PrintDocument.Print() ?
nbnelson
Posts: 11
Joined: Thu Nov 13 2003

Post by nbnelson »

Yes I do enable the printer before printing to it. It seems as if it tries to print because the "Printing" messagebox starts to appear on the screen before the exception happens. Almost like the printer is off or something.

Any input is greatly appreciated....

C#

aPointer = PDF.PDFDriverInit("AccelSurvey PDF Converter");
int me = (int) aPointer;

if (Convert.ToString(me) == null)
{
MessageBox.Show("There was an error initializing the printer", "Error");
}

int aPrinter = PDF.SetDefaultPrinter(aPointer);

//Then i call a printer dialog where the user can select my printer named "AccelSurvey PDF Converter"

//Then i go to a Sub. to do the rest of the work.
PDF.EnablePrinter(aPointer, "ACCELDATA", "07EF......");

int myFile = PDF.SetDefaultFileName(aPointer, "c:\\AccelSurvey.pdf");

myFile = PDF.SetFileNameOptions(aPointer, (int) aNoPrompt + (int) aUseFileName);

//HERE IS WHERE THE ERROR OCCURS EVERYTIME
//".....The device is not ready System.ComponentModel.Win32Exception
this.SurveyPrintDocument.Print();

mPdfFile = PDF.SetFileNameOptions(aPointer, 0);

//End Printer Driver
PDF.DriverEnd(aPointer);
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

Please find below your code with some minor changes. Please use this code it should work, if not please contact support@amyuni.com.


aPointer = PDF.PDFDriverInit("AccelSurvey PDF Converter");
PDF.EnablePrinter(aPointer, "ACCELDATA", "07EF......");

int me = (int) aPointer;

if (Convert.ToString(me) == null)
{
MessageBox.Show("There was an error initializing the printer", "Error");
}

int aPrinter = PDF.SetDefaultPrinter(aPointer);

//Then i call a printer dialog where the user can select my printer named "AccelSurvey PDF Converter"

//Then i go to a Sub. to do the rest of the work.

int myFile = PDF.SetDefaultFileName(aPointer, "c:\\AccelSurvey.pdf");

myFile = PDF.SetFileNameOptions(aPointer, (int) aNoPrompt + (int) aUseFileName);

//HERE IS WHERE THE ERROR OCCURS EVERYTIME
//".....The device is not ready System.ComponentModel.Win32Exception

PDF.EnablePrinter(aPointer, "ACCELDATA", "07EF......");
this.SurveyPrintDocument.Print();

mPdfFile = PDF.SetFileNameOptions(aPointer, 0);

//End Printer Driver
PDF.DriverEnd(aPointer);

Hope this helps.
nbnelson
Posts: 11
Joined: Thu Nov 13 2003

Post by nbnelson »

Thank you for your reply, however, I am still receiving the same error:
System.ComponentModel.Win32Exception
The device is not ready.

I used the DLLImport function in a new class called PDF. Everything works fine until I get to that line of code. By 'fine', I mean that all of the return values are correct and even the printer is set to default by calling the SetDefaultPrinter function.

Has anyone else ever received this error?

Thanks again...
nbnelson
Posts: 11
Joined: Thu Nov 13 2003

Found it

Post by nbnelson »

Thanks to the technician I called, I found out that I needed to use Licensee="Evaluation Version Developer" name instead of my company name.


Thanks
Post Reply