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?
Call to PDF RestoreDefautPrinter does not always work
Call to PDF RestoreDefautPrinter does not always work
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;
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;