PDF Converter in Windows 2008 server

If you are a Power Builder developer and have any questions about using our products from Power Builder here is the place to post them.
Post Reply
sebastien
Posts: 6
Joined: Fri Sep 25 2009

PDF Converter in Windows 2008 server

Post by sebastien » Mon Sep 28 2009

Hello,
I am evaluating the Amyuni PDF Converter in order to use it in our software developped in Powerbuilder 11.2.
On a french Windows 2008 Server (access with Remote Desktop), I cannot print on the PDF Converter printer, if I am logged as a simple user.
If I log as Administrator, I can print with no problem.

Here is my code sample :
--------------

string ls_document_name, ls_default_printer
integer li_ret
long ll_pdf
Constant integer NoPrompt = 1 // do not prompt for file name
Constant integer UseFileName = 2 // use file name set by SetDefaultFileName else use document name

ls_default_printer = PrintGetPrinters()
PrintSetPrinter("My PDF Converter")

ll_pdf = PDFDriverInit("My PDF Converter")

// Define a unique filename
if len(trim(dw_liste.Object.DataWindow.Print.DocumentName)) = 0 then
dw_liste.Object.DataWindow.Print.DocumentName = "Edition_" + string(today(), "yyyymmdd") + "_" + string(now(), "hhmmssffff") + ".pdf"
end if
ls_document_name = dw_liste.Object.DataWindow.Print.DocumentName

SetResolution(ll_pdf, 600)
SetDefaultConfig(ll_pdf)
SetDefaultPrinter(ll_pdf)
SetDefaultFileName(ll_pdf, "C:\AFAC\" + ls_document_name)

SetFileNameOptions(ll_pdf, 3)

dw_liste.Object.DataWindow.Printer = "My PDF Converter"
EnablePrinter(ll_pdf, "Evaluation Version Developer Pro", "07...")
li_ret = dw_liste.Print()
if li_ret < 0 then
Messagebox("error", "print error")
end if

PrintSetPrinter(ls_default_printer)
DriverEnd(ll_pdf)
----------

All I get is "print error".
It is not a licensing problem (if I change the license code I get "printer not licensed").
As stated in another topic on this forum I have given the Full Control rights in the registry on the HKEY_CURRENT_CONFIG\Software\My PDF Converter to All Users (if I don't do this I get a printer not activated -20 message).

I don't see anything more that I can do...
Is there a way to get a debug or trace file ?

Thanks in advance, Sebastien

eric.glenn
Posts: 11
Joined: Tue Sep 02 2008

Re: PDF Converter in Windows 2008 server

Post by eric.glenn » Mon Nov 23 2009

EnablePrinter returns a long value.
The return value is False if the printer handle is invalid, True otherwise.

The value returned by the print function is where you can find the real problem. Here is an description of the negative return codes
-20 Name of licensee could not be read (License registry entry not found)

-21 Activation code could not be read (Code registry entry not found)

-22 Activation code does not correspond to Licensee (wrong combination of Licensee/Code)

-30 Timeout, printer has timed out

-40 Invalid Platform

-41 Trying to activate a new version of the PDF Converter with an activation key of the previous version.
It doesn't hurt to check to see if the CDI returned an error message. After each CDI call, you should use the CDI subroutine getlasterrormsg.

External Function Declaration

Code: Select all

Subroutine GetLastErrorMsg (String Msg, Long MaxMsg)Library "cdintf300.dll" alias for "GetLastErrorMsg;Ansi"
Example code to get last error message

Code: Select all

string ls_msg

ls_msg = fill( " ", 256 )

// send characters but tell the Amyuni function that it is one character less
// in case the Amyuni function adds a \0 at the end of the string
getlasterrormsg( ls_msg, len( ls_msg) -1 ) // getlasterrormsg returns Void but modifies ls_msg

ls_msg = trim( ls_msg  )

I hope this helps!

sebastien
Posts: 6
Joined: Fri Sep 25 2009

Re: PDF Converter in Windows 2008 server

Post by sebastien » Mon Nov 23 2009

Hello Eric,
thank you very much for your help.
Unfortunately the powerbuilder print function returns -1 in any case of error.
The EnablePrinter returns 1.
If I call getlasterrormsg after print() or enableprinter() the error message returned is empty
Regards,

Post Reply