Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
'error accessing print spooler' using SET PRINTER TO NAM
Message
From
19/04/2000 12:27:26
 
 
To
19/04/2000 12:17:29
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00361356
Message ID:
00361367
Views:
12
>I am having a problem in the last mile of releasing an eMail option for my reports. I am using the Amyuni driver to create PDF formatted output & sending the resultant file as an attachment. After some recoding and some help from Amyuni ( they gave me an FLL so I would not have to use DLL calls and other very usefull suggestions & examples - good company), I got the whole thing to work prefectly on my NT SP6 workstation. I then compiled the code to an exe (VFP6 SP3) and sent it to one of my users. Much to my disappointment it bombed saying "error accessing print spooler". I tracked the problem down to the line SET PRINTER TO NAME "My PDFPrinter". Yesterday, I found a referance to this problem in a thread here. This thread implied that the printer name might be too long ( set printer name in SP3 does not support long names). So, I shortened it to "eMail", less than 8 char. I had high hopes this would cure the problem but allas no luck, same error. My work station machines are
>Win95b Osr2 systems.
>
>The thread said I could find other referances to the problem in old threads but I was unable to locate any.
>
>Thanks in advance,
>
>Terry
>
>P.S. The users are patient as they WANT this capability. So, I can experiment on their machines without too much yelling.


Sorry I forgot the code sample. Here it is.

WAIT WINDOW " Translating file for eMail. " NOWAIT
***************************************************************************
*** Setup PDF printer driver and print to pdf file
***************************************************************************
LOCAL lcLibrary, lcPDFName, lnPDFStatus, lcErrorMessage
* Save current status
lcLibrary = SET("Library")
* Set file name
lcPDFName = SYS(5) + SYS(2003) + "\" + ;
ALLTRIM(ThisForm.cboReportSelection.Value) + ".pdf"
* Error message holder
lcErrorMessage = ""

* WAIT WINDOW " Before Set Library "
SET LIBRARY TO "FllIntf.fll" ADDITIVE
* On Error return
* lnPDFStatus = DriverInit( "My PDF Printer" ) && for the standard version
* WAIT WINDOW " Before PDFDriverInit "
lnPDFStatus = PDFDriverInit( "eMail" ) && for the developer version
IF lnPDFStatus = 0
* Returned an error. Show user & exit
lcErrorMessage = LASTERRORMSG()
lcErrorMessage = ALLTRIM(lcErrorMessage)
= MESSAGEBOX( ;
"SORRY! Something went wrong initializig the PDF" + CHR(13) + ;
"file generator for this report. With out it you" + CHR(13) + ;
"can't eMail this report. Please tell the programmer" + CHR(13) + ;
"what you were trying to do and the following error" + CHR(13) + ;
"code: " + "'" + lcErrorMessage + "'", 0+16+0)
RETURN
ENDIF <> 0

* DefaultFileName( lnPDFStatus, lcPDFName ) && set output file name
DefaultFileName( lnPDFStatus, lcPDFName ) && set output file name
FileNameOptions( lnPDFStatus, 1 + 2 ) && no prompt + use file name

* WAIT WINDOW " Set printer to "
SET PRINTER TO NAME "eMail"

* WAIT WINDOW " Before report "
REPORT FORM &gcReport TO PRINTER NOCONSOLE

* Reset printer name
SET PRINTER TO DEFAULT

* WAIT WINDOW " Before driver end "
DriverEnd( lnPDFStatus ) && remove the PDF or HTML printer

* Reset library status
RELEASE LIBRARY "FllIntf.fll"
It is impossible to make programs idiot proof. Idiots are too cleaver.

MCP( Tcp/Ip )
Previous
Reply
Map
View

Click here to load this message in the networking platform