I am evaluating the PDF Converter Developer Version ActiveX interface for use with PowerBuilder 10.5 / EAServer in a Windows XP and 2000 environment. After reviewing the docs I tried various renditions of my code to simply create a pdf file by printing from a datastore. When testing, the Windows Output File Name Dialog Box Displays just after I issue a print() statement. If I supply the name and click OK the pdf file is created.
In debug I notice that the boolean return value from the statements
lb_rtn = pdfobj.DefaultFileName = ls_qualified_file_name is false
lb_rtn = pdfobj.FileNameOptions = 3 is false.
I would appreciate suggestions to get me going. I want to check out file appending, encryption, and password protection next.
Thanks,
Bob Olsen
Below is my last version of code:
Code: Select all
// ****************** Amyuni Code ************************************************************************
pdfobj = create oleobject
li_rtn = pdfobj.ConnectToNewObject("APToolkit.Object")
//Connect the pdfobj ole object to the cdintf interface of CDIntf.dll
li_rtn = pdfobj.ConnectToNewObject("CDIntfEx.CDIntfEx")
// li_rtn = pdfobj.ConnectToNewObject("cdintf.cdintf")
// Attach to PDFprinter
pdfobj.DriverInit (PrinterName) // PrinterName is declared as the name of the existing printer
//ll_value = pdfobj.PdfDriverInit("My PDF Export")
ll_value = pdfobj.EnablePrinter(LicensedTo,ActivationCode)
// Set file options to no prompt and use file name
lb_rtn = pdfobj.FileNameOptions = 3
ls_msg = pdfobj.GetLastErrorMsg()
// For the Developer license you can use:
// PDFPrinter.PdfDriverInit "My PDF Export"
// To install the printer only for the time your application is running.
// ll_value = pdfobj.EnablePrinter(LicensedTo,ActivationCode)
//
// ls_msg = pdfobj.GetLastErrorMsg()
// Set this printer as default
// pdfobj.SetDefaultPrinter
PrintSetPrinter("Amyuni PDF Converter")
ids_composite_report.Object.DataWindow.Print.DocumentName="Ros.pdf"
// Set output PDF file name
lb_rtn = pdfobj.DefaultFileName = ls_qualified_file_name
ls_msg = pdfobj.GetLastErrorMsg()
// Enable the printer before each printout. This is for the Developer version 2.1
//pdfobj.EnablePrinter(LicensedTo,ActivationCode)
// Set this printer as default
lb_rtn = pdfobj.SetDefaultPrinter
//
// ls_msg = pdfobj.GetLastErrorMsg()
pdfobj.SetDefaultConfig
ll_value = pdfobj.EnablePrinter(LicensedTo,ActivationCode)
// Print the list
li_rtn = ids_composite_report.print()
//lb_rtn = pdfobj.RestoreDefaultPrinter
// Reset options to zero
pdfobj.FileNameOptions = 0
pdfobj.DriverEnd
// destroy the pdf object
Destroy pdfobj
// ****************** Amyuni Code End ************************************************************************