Windows Output File Name Dialog Box Displays on Printing

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
Posts: 1
Joined: Tue Jan 16 2007
Location: Marlton, NJ

Windows Output File Name Dialog Box Displays on Printing

Post by bobo »

Hello All,

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.


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")	
	// 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
	// Set this printer as default
   	lb_rtn = pdfobj.SetDefaultPrinter
//	ls_msg = pdfobj.GetLastErrorMsg()

	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
	// destroy the pdf object
	Destroy pdfobj
	//		******************	Amyuni Code	End	************************************************************************
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002

Post by Joan »


Please try to replace ls_qualified_file_name
by "c:\test.pdf" or another explicit name and path.

This should help. Also please try to replace FileNameOptions by FileNameOptionsEx but i am not sure if this would have any impact.

I noticed in the sample that at one place you are using 'Printer Name' and at another you are using 'Amyuni PDF Converter', please use exactly the same name in the two locations, you might have two different printers on your system and accidently refering the two printers in your code.

Hope this helps.
Post Reply