PowerBuilder 9.0 datawindow exporting PDF files
Export datawindow to a PDF file. For this reason, I have tried several versions of PowerBuilder (PowerBuilder 9.0, PowerBuilder 10.0), but none of them have been successful. I always thought it was a PB bug. Today I found a lot of information on the Internet and finally got it done. The original installation of gs705w32.exe and Acrobat virtual printer. PB exporting PDF files in this way is too unprofessional.
1. Download and install gs705w32.exe
Http://www.processlist.com/info/gs705w32.html
2. Install gs705w32.exe. The default installation path is C:/Gs.
3. Install a virtual printer
1) directly on the Control Panel> printer and fax> Add a printer. The default port is LPT1;
2) The printer driver comes with powerbuilder9.0, which is located in the installation folder of powerbuilder9.0,
Choose install from disk> X: \ Program Files \ Sybase \ shared \ PowerBuilder \ drivers, select adist5.inf, and read the following five drivers:
Acrobat Distiller,
Acrobat Distiller CS,
Acrobat Distiller CT,
Acrobat Distiller J,
Acrobat Distiller K
Select the first Acrobat Distiller
4. Use SaveAs () in the code to output the pdf file: int li_rc
String ls_title = "output pdf file"
String ls_PathName, ls_FileName
// Select the output file
Li_rc = getfilesavename (ls_title, ls_pathname, ls_filename, "pdf", "pdf file (*. pdf), *. pdf ")
If (li_rc = 1) then
// Use the distill method to output a PDF file
Dw_1.object.data={export.}.method = distill!
// Select a printer
Dw_1.object.data1_1_printer = "Acrobat Distiller"
Dw_1.object.data+{export.}.distill.custompostscript = "Yes"
// Output a pdf file
If (dw_1.SaveAs (ls_PathName, PDF !, True) = 1) then
Messagebox (ls_title, "saved successfully! ")
Else
Messagebox (ls_title, "failed to save! ", StopSign !)
End if
End if
The above programs are successfully debugged under PowerBuilder 9.01 Build 7096.
In addition, you can edit the. BAT file in X: \ Program Files \ Sybase \ Shared \ PowerBuilder \ drivers and write:
Rundll32.exe printui. dll, PrintUIEntry/if/f. \ ADIST5.INF/r "LPT1:"/B "Acrobat Distiller"/m "Acrobat Distiller"
Run it to add a virtual printer.