"Error lodaing printer driver" Citrix installation

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
jenewman
Posts: 3
Joined: Fri Apr 02 2004
Location: Texas

"Error lodaing printer driver" Citrix installation

Post by jenewman »

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.

Jay Newman

Code: Select all

* create pdf file
TRY
	oPdfPrinter = this.pdfprinterobject
	oPdfPrinter.FileNameOptions = No_Prompt + UseFileName + BroadcastMessages + iif(lConcatenate,Concatenate,0) 
	oPdfPrinter.DefaultFileName = (cPdfFileName)  && set output file name
	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"
		&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.
ENDTRY
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

The call to EnablePrinter() should be the last call before your Print command.

Please try to call 'Set Printer To Name' before calling EnablePrinter().

Hope this helps.
jenewman
Posts: 3
Joined: Fri Apr 02 2004
Location: Texas

Post by jenewman »

That doesn't seem to have worked. Here is the revised code:

Code: Select all

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.

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

Post by Joan »

Hello,

I checked the code you are using and it seems to be invalid.

Please try to use a code instead.

Hope this helps, if not please you will need to contact our Technical Support support@amyuni.com

Best Regards.
Last edited by Joan on Thu Dec 09 2004, edited 1 time in total.
jenewman
Posts: 3
Joined: Fri Apr 02 2004
Location: Texas

Post by jenewman »

That isn't my licensee name. That line is commented out. Does this change anything?
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

In this case your activation code is right. I remove it from the post however because this code is private.

I checked your VFP code and it seems fine.

You are using the DLL interface of CDIntf210.dll. Did you check that CDintf.dll is stored in the same directory as your application?

Are you using the latest version 2.10i-8 of the driver or an older version?

checking the return value of EnablePrinter, will this work.

Thanks.
Jose
Amyuni Team
Posts: 553
Joined: Tue Oct 01 2002
Contact:

Post by Jose »

Hello,

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.

Hope this helps?

Thanks
Post Reply