Saving as PDF using the distill method
If you want to save to PDF using the distill method, you do
not need to change any properties. The distill method is used by
default when you select Save Rows As from the File menu in the DataWindow painter and
select PDF as the file type, or when you use the SaveAs method
with PDF! as the file type.
PowerBuilder uses a PostScript printer driver specifically designed
for distilling purposes to configure the PDF output. You can choose
to use a different PostScript printer driver if you want to customize
your PostScript settings for generating PDF.
In the DataWindow painter
To use a custom PostScript printer driver, you must set some
properties.
To save customized distilled PDF output in the DataWindow painter:
-
Select the Data Export tab in the Properties
view for the DataWindow object. -
Select PDF from the Format to Configure drop-down
list, select Distill! from the Method drop-down list, and select
the Distill Custom PostScript check box. -
Select the Print Specifications tab and specify
the name of the printer whose settings you want to use in the Printer
Name box. -
Save the DataWindow object, then select File>Save
Rows As, select PDF as the Save As Type, specify a file name, and
click Save.
In a script
The properties you set in the DataWindow painter are saved
with the DataWindow object and are used by default when your application
runs, but for more control, specify the properties in a script before
saving the DataWindow object. To specify a custom printer driver
in a script, set the Export.PDF.Distill.CustomPostScript property
to Yes and specify a printer with the DataWindow.Printer property:
|
1 |
int li_ret<br> <br>dw_1.Object.DataWindow.Export.PDF.Method = Distill!<br>dw_1.Object.DataWindow.Printer = "\prntsrvrpr-6"<br>dw_1.Object.DataWindow.Export.PDF. &<br>   Distill.CustomPostScript="Yes"<br> <br>li_ret = dw_1.SaveAs("custom.PDF", PDF!, true) |
System requirements for
the distill method
Users must have administrative privileges to create a PDF
file.
To support saving as PDF using Ghostscript, you must download
and install Ghostscript files on your system as described in the
chapter on deploying applications and components in Application
Techniques. You also need to install
PostScript driver files.
If you have installed a PostScript printer on your computer,
the PostScript driver files required to create PDF files, PSCRIPT5.DLL, PS5UI.DLL,
and pscript.ntf, are already installed, typically
in C:WINDOWSsystem32spooldriversw32x86 on
Windows XP or C:WindowsSystem32DriverStoreFileRepository
tprint.inf_1a216484Amd64 on
a 64-bit Vista system. You must use the version of these files that
is appropriate to the operating system where the PDF file is created.
You should copy the files to the SAPSharedPowerBuilderdrivers directory.
If you have never installed a PostScript printer, use the
Printers and Faxes option in the Windows control panel to install
a generic PostScript printer. If the Pscript5.dll has
never been installed, you may be prompted to insert the Windows
install CD.
Other related files are installed in SAPSharedPowerBuilderdrivers.
Saving as PDF fails at runtime on Windows 2003 Server. This
is caused by a Group Policy that by default disallows installation
of printers that use kernel–mode drivers. Kernel-mode drivers
have access to system-wide memory, and poorly written drivers can
cause system failures. To allow installation of kernel-mode drivers,
follow these steps:
-
Select
Run from the Windows Start menu. -
In the Open box, type
gpedit.mscand
click OK. -
In the Group Policy console, expand Computer Configuration, Administrative
Templates, and Printers. -
Disable “Disallow Installation of Printers
Using Kernel-Mode Drivers.”
When you deploy applications that use the ability to save
as PDF with the distill method, you must make sure your users have
installed Ghostscript and have access to the drivers directory.
See the chapter on deployment in Application Techniques for
more information about redistributing these files.