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.
I have installed the PDF converter on Windows NT machines, in the past, and have never had a problem before. When I am using the PDF Converter on a Citrix I need the driver to be persistent. I installed the printer on the server using the install.exe and it shows up in the printer manager with the correct name and users have all permissions granted to use the printer however they wish. Secondly, I call DriverInit instead of PdfDriverInit before I print to the driver. When I attempt to print I get an "Error 1958: Error loading printer driver" error. It is line 64 (the line that reads: "&cReportCommand." below) Thank you for your support.
LPARAMETER cReportCommand, cPdfFileName, lConcatenate, nDataSessionID
* cReportCommand = command string that prints a report to pdf file
* cPdfFileName = name of the pdf file that is created
* lConcatenate = true to concatenate reports in a single file; false to overwrite
LOCAL lConverter
LOCAL lResult
LOCAL oPdfPrinter
LOCAL oError as Exception
LOCAL lReady
IF TYPE('nDataSessionID') = 'N'
SET DATASESSION TO nDataSessionID
ENDIF
* define constants
#define No_Prompt 1 && do not prompt for file name
#define UseFileName 2 && use file set by DefaultFileName
#define Concatenate 4
#define BroadcastMessages 32 && allows for bookmarks
#define EnableWatermarks 64
#define LicenseTo "Licensee Name"
*!* #define LicenseTo "Evaluation Version Developer"
#define ActivationCode "1111111111111"
* watermark settings
#define Wfontname "Arial"
#define Wfontsize 70
#define Worientation 0
#define Wcolor 12632256 && RGB(192,192,192)
#define Whorzpos 300
#define Wvertpos -400
#define Wforeground .t.
* check for the printer driver 'DNA PDF Converter'
lConverter = .f.
IF APRINTERS(aPrinterList) > 0
FOR k = 1 TO ALEN(aPrinterList,1)
IF ALLTRIM(aPrinterList[k,1]) = "DNA PDF Converter"
lConverter = .t.
ENDIF
NEXT
ELSE
lConverter = .f.
ENDIF
IF !lConverter
WAIT WINDOW "PDF printer service is unavailable. Attempting to start PDF printer service now." NOWAIT
this.createpdfobjects()
ENDIF
* create pdf file
TRY
oPdfPrinter = this.pdfprinterobject
oPdfPrinter.FileNameOptions = No_Prompt + UseFileName + BroadcastMessages + iif(lConcatenate,Concatenate,0) && + EnableWatermarks
oPdfPrinter.DefaultFileName = (cPdfFileName) && set output file name
*!* oPdfPrinter.SetWatermark = "D Newman & Associates",Wfontname,Wfontsize,Worientation,Wcolor,Whorzpos,Wvertpos,Wforeground &&add watermark
lReady = oPdfPrinter.EnablePrinter(LicenseTo, ActivationCode)
IF TYPE('lReady') = "N"
lReady = IIF(lReady = 0, .t., .f.)
ENDIF
IF lReady
set printer to name "DNA PDF Converter" && print to pdf "printer"
oPdfPrinter.EnablePrinter(LicenseTo, ActivationCode)
&cReportCommand.
lResult = .t.
ELSE
MESSAGEBOX("The PDF printer failed to initialize.",0+64,"PDF Printer Not Initialized")
lResult = .f.
ENDIF
IF TYPE("oPdfPrinter") = "O" AND !ISNULL(oPdfPrinter)
oPdfPrinter.FileNameOptions = 0 && reset file options
oPdfPrinter.RestoreDefaultPrinter()
ENDIF
CATCH TO oError
MESSAGEBOX("The PDF file could not be created. The following error was encountered: " + CHR(13) + ;
"Error Number " + ALLTRIM(STR(oError.ErrorNo,10,0)) + " - " + oError.Message + CHR(13) + ;
"Procedure: " + ALLTRIM(oError.Procedure) + ". Line Number: " + ALLTRIM(STR(oError.LineNo,10,0)),0+64,"PDF File Not Created")
lResult = .f.
FINALLY
ENDTRY
RETURN lResult
I really need this work soon. The same error message is coming up.
The situation you are encountering is caused by the fact that when a VFP report is modified, it stores information about the printer it will use. If at the time you modified the report the PDF driver does exist your report will save information about another printer.
In order to resolve this you will need to delete the printer information stored in the Expr. Tag and Tag2 columns of your
.frx file.