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
Device not ready
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);
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);
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.
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.
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...
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...