Call to PDF RestoreDefautPrinter does not always work

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
reg
Posts: 2
Joined: Tue Apr 24 2007

Call to PDF RestoreDefautPrinter does not always work

Post by reg »

We support a third party application that uses the AmyUni PDF Printer to create PDF files.

In order to ensure the report goes to the PDF printer, this is set to the default printer, and then the RestoreDefaultPrinter function is called to set this back to what it was before.

Sometimes after this application has generated a pdf report, the default printer is still the AmyUni Printer, and occationally there is no default printer at all.

Is there anything that can be done to ensure that the RestoreDefaultPrinter call works more consistently? Are any versions more stable in this regard than other versions?

Alternatively is there a suggested work around?
Jose
Amyuni Team
Posts: 553
Joined: Tue Oct 01 2002
Contact:

Post by Jose »

Hello,

We are not aware of this issue and in order to narrow down the possible source of your issue you will need to post additional information.

1- What OS are is your application installed on?

2- What programming language is your application developed with?

Thanks
reg
Posts: 2
Joined: Tue Apr 24 2007

Call to PDF RestoreDefautPrinter does not always work

Post by reg »

Hi Jose,

The users are on Windows XP, and the application calling the PDF Driver is Dynamics NAV.

Before printing makes following function calls

IF ISCLEAR(PDFConverter) THEN
CREATE(PDFConverter);

PDFConverter.DriverInit('Navision PDF Converter');
PDFConverter.FileNameOptions(3);
PDFConverter.DefaultDirectory(ENVIRON('TEMP') + '\');
PDFConverter.SetDefaultPrinter;
TempFileName := ENVIRON('TEMP') + PDFName;
PDFConverter.DefaultFileName(TempFileName);


After Print to PDF calls the following

PDFConverter.FileNameOptions(0);
PDFConverter.RestoreDefaultPrinter;
Post Reply