I'm using Amyuni developer edition 4.5. I ran a snippet of code below and when I invoked EnablePrinter(), it caused an exception.
The error messaged was "API call caused an exception". I called LastErrorMsg() and it returns "The printer name is invalid".
I have not installed the printer driver by running install.exe
I'm using visual foxpro 8/9, running XP SP3.
Any suggestions would be greatly appreciated.
m.lcPrinterName = "Amyuni PDF Converter"
m.lcLicensedTo = "CompanyLicensedTo"
m.lcActivationCode="CompanyActivationCode"
m.lcLib=sys(5)+curdir()+[fllIntf450.fll]
m.llError=.f.
try
set library to (m.lcLib) addi
m.pdf = PDFDriverInit(m.lcPrinterName)
if m.pdf=0
EnablePrinter(m.pdf,m.lcLicensedTo,m.lcActivationCode)
endif
set printer to name (m.lcPrinterName)
catch to loException
?lastErrorMsg()
m.llError=.t.
endtry
if m.llError
messagebox(transform(m.loException.errorNo)+chr(13)+chr(10)+m.loException.message)
endif
EnablePrinter() caused error: 2028
Re: EnablePrinter() caused error: 2028
Hello,
I believe that your issue may be that PDFDriverInit() is failing.
The PDFDriverInit() function will basically fail in a couple of different situations..
One: Make sure to copy all distributable files to the application’s main directory. The application’s main directory is usually where the executable file is located and the list of distributable files is as follows:
acfpdf.txt
acfpdfu.dll
acfpdfuamd64.dll
acfpdfui.dll
acfpdfuiamd64.dll
amyuni.inf
atpdf450.cat
cdintf.dll
Install.exe
install.ini
xmllite.dll
xmllite64.dll
cdintf64.dll
If one of these files is missing then the PDFDriverInit() function will fail.
Two: Make sure that on the system you are calling PDFDriverInit() that you have only one instance of the CDintf.dll.
Three: When using the activex interface of the PDFDriverInit() function, the function will look for the dependency files in the directory where cdintf.dll (cdintf450.dll) was registered and not in the application directory (where the EXE is located). In this scenario you will need to register cdintf.dll (cdintf450.dll) in the same directory as the dependencies, so that the DLL can find the other driver files.
Four: The PDFDriverInit() function dynamically installs the PDF Converter on the user’s system. If the logged in used does not have administrator privileges on the system, the function will fail. In the case where the logged in user does not have administrator privileges, you can install the printer on their system using Install.exe (Install.exe should be run by an administrator) and inside your application you replace PDFDriverInit by DriverInit (the printer will remain on the system even when the application ends). DriverInit will take as parameter a string containing the printer name as it appears in your printers' folder.
Thanks
I believe that your issue may be that PDFDriverInit() is failing.
The PDFDriverInit() function will basically fail in a couple of different situations..
One: Make sure to copy all distributable files to the application’s main directory. The application’s main directory is usually where the executable file is located and the list of distributable files is as follows:
acfpdf.txt
acfpdfu.dll
acfpdfuamd64.dll
acfpdfui.dll
acfpdfuiamd64.dll
amyuni.inf
atpdf450.cat
cdintf.dll
Install.exe
install.ini
xmllite.dll
xmllite64.dll
cdintf64.dll
If one of these files is missing then the PDFDriverInit() function will fail.
Two: Make sure that on the system you are calling PDFDriverInit() that you have only one instance of the CDintf.dll.
Three: When using the activex interface of the PDFDriverInit() function, the function will look for the dependency files in the directory where cdintf.dll (cdintf450.dll) was registered and not in the application directory (where the EXE is located). In this scenario you will need to register cdintf.dll (cdintf450.dll) in the same directory as the dependencies, so that the DLL can find the other driver files.
Four: The PDFDriverInit() function dynamically installs the PDF Converter on the user’s system. If the logged in used does not have administrator privileges on the system, the function will fail. In the case where the logged in user does not have administrator privileges, you can install the printer on their system using Install.exe (Install.exe should be run by an administrator) and inside your application you replace PDFDriverInit by DriverInit (the printer will remain on the system even when the application ends). DriverInit will take as parameter a string containing the printer name as it appears in your printers' folder.
Thanks
Get PDF Suite, the expert .NET developer toolkit for PDF conversion, creation and editing - www.amyuni.com/pdfsuite