Link to home
Start Free TrialLog in
Avatar of renju123
renju123

asked on

Send Document from Power Builder Application to pdf format

Is it possible to print the documents or in other words some window with data
in it to a pdf format?
The data from a window at the click of a button needs to be converted into a pdf format file.

This is needed in PB5 ?
Is it possible to code it?

If not , does the higher versions of PB support it?
ASKER CERTIFIED SOLUTION
Avatar of SylvainPouliot
SylvainPouliot

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
PB9 Supports saving datawindows to PDF format.
For lower versions, there are some printer drivers available that help you print your DW to a PDF file.
You can download demo versiond of printer drivers from net. (One such is available at : http://download.com.com/3000-2116-10135980.html?tag=lst-0-20)


Regards,
Vikas Dixit
Avatar of jammerd
jammerd

SylvianPouliot has got the right idea.  I've used Jaws Pdf for about a year printing from powerbuilder.  When you print with it, the "documentname" property determines the file name.  ( Jaws PDF creator has a setting for the file location ).

// an example for printing a datastore

ids_packing_list.Object.DataWindow.Print.DocumentName = "file_name_you_want"      
if( is_do_pdf = "T" ) then
    PrintSetPrinter( "Jaws PDF Creator" )   // if this function is not available in your version of PB,
                                                                 //  then you have to set it some other way
else
    PrintSetPrinter( is_default_printer )
end if

ids_packing_list.Print()
PrintSetPrinter( is_default_printer )
is_do_pdf = "F"


The new PB9 can save a datawindow to a PDF file, but when I tried it the resolution was not very good ( I print invoices with graphic symbols, etc ).
Avatar of renju123

ASKER

Thanks a million for all the answers. :))
But I still have a query.

My application is in PB5 and I cannot change it to PB9.

From the anwers that I got  I understand there are 2 things :
1.Saving datawindow to the pdf format
2.Printing in the pdf format.

Only PB9 supports saving data window to the pdf format.
And printing in pdf format can be accomplished even by the lower versions using the pdf printer drivers.

Is my analysis correct?

I need to save the datawindow to a pdf format using PB5 and then print the same.
Is it possible ?
Pls increase my points ..I need to ask few more questions
Hi.
first of all, ask more questions in different "question".  that way, you'll have more chance that someone will pick your question based on the title.

Second, yes you are right, you can create pdf with older version of pb...


and now for the pdf, here's how I make it work:

Install Adobe Acrobat full version (not only the Reader... you'll need Distiller/PDFWRITER)
Then set your Acrobat PDFWRITER to the Default printer.
use:
dw_1.print() to print your datawindow, it will ask you for a filename

If you want to automaticaly save it in a pdf file use:
RegistrySet("HKEY_CURRENT_USER\Software\Adobe\Acrobat PDFWriter","PDFFileName", RegString!, ls_filename)
dw_1.print()

It will create your pdf file with no user intervention...

Hi,

1.Saving datawindow to the pdf format.
2.Printing in the pdf format.

Here Both are same :  "print your DW to a PDF file" means  saving it as a PDF with help of a printer driver.
You can down load the driver I suggested and try. You can give a default file name there to save, or else it displays a dialog asking for location/name of the file.

regards,
Vikas Dixit
Thanks again for the answers.

So what I infer is that it is possible to save data window to a pdf format and then print it even in PB5.
For that I need to install some printer drivers.

I tried to download the trial version of the printer driver that was specified
http://download.com.com/3000-2116-10135980.html?tag=lst-0-20 ...
On installing it I am getting the following error:
"The procedure entry point AddPrinterDriverExW could not be located in the dynamic link library WINSPOOL.DRV"


Regards,
Renju
Hi,
This driver seems to require Win NT/2K/XP.

If you have different OS, others are available at :
http://download.com.com/3000-2116-10198366.html?tag=lst-0-2
http://download.com.com/3000-2116-10127667.html?tag=lst-0-24

Or do a search for "PDF printer drivers" on the web !

regards,
Vikas Dixit
Jaws PDF Creator works on Windows 98 and its a good product.
I have been able to download the Jaws PDF Creator trial version.

It is converting the documents into the pdf format.
I want to set the default printer to the Jaws pdf creator on the click of a particular button and then restore it back to the default printer.
AS I am using PB5 the PrintSetPrinter function does not work.

SO I tried the following code but it gives the error that sle_def and sle_new are not defined.I have Windows NT system

//STEP 1: Get the current default printer name.
string ls_default
RegistryGet("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device", ls_default)
sle_def.text = ls_default

//Step 2: Set a new default printer name.
int li_rtn
li_rtn = RegistrySet("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows", & 
"Device", sle_new.text)
if li_rtn = 1 then
Messagebox("Setting new printer name", "Successful")
else
Messagebox("Setting new printer name", "Failed")
end if
 
 
 
 Regards,
Renju

 

 
   
 
 

sle_def and sle_new are Controls...replace it by the appropriate variable....
Create those functions...

//***********
f_return_default_printer (return string)
string ls_default
RegistryGet("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device", ls_default)
return ls_default
//***********

//***********
//Step 2: Set a new default printer name.
f_set_Default_printer (string as_printername)
int li_rtn
li_rtn = RegistrySet("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows", & 
"Device", as_printername)
if li_rtn = 1 then
Messagebox("Setting new printer name", "Successful")
else
Messagebox("Setting new printer name", "Failed")
end if
//***********