一个简单的dw.print()
PrintManager窗口中显示SaveAS did not complete successfully, return code is : -1
但是得到dw.print()返回值是1,表示是成功的。
xp的ASPNET用户组有发布目录的所有权限,并且dw.saveas()也是可以用的。
何解?
...全文
2425打赏收藏
webform 数据窗打印失败
一个简单的dw.print() PrintManager窗口中显示SaveAS did not complete successfully, return code is : -1 但是得到dw.print()返回值是1,表示是成功的。 xp的ASPNET用户组有发布目录的所有权限,并且dw.saveas()也是可以用的。 何解?
Download the self-extracting executable file for the Ghostscript version you want from one of the locations listed on the Ghostscript Web site .
Run the executable file to install Ghostscript on the server computer.
The default installation directory is C:\program files\gs. You can select a different directory and/or choose to install shortcuts to the Ghostscript console and readme file.
Location of files When a Web Forms application user saves a DataWindow object as a PDF, the Web Forms server searches in the following locations for an installation of Ghostscript:
The Windows registry
The relative path of the pbdwm115.dll file (typically in the Sybase\Shared\PowerBuilder directory)
The system PATH environment variable
If Ghostscript is installed using the Ghostscript executable file, the path is added to the Windows registry.
If the Ghostscript files are in the relative path of the pbdwm115.dll file, they must be installed in this directory structure:
where dirname is the directory that contains the runtime DLLs and N.NN represents the release version number for Ghostscript.
For information about fonts supplied with Ghostscript, see the APFL Ghostscript Web site .
You must also make sure the default PostScript printer driver and related files in Sybase\Shared\PowerBuilder\drivers are included in the IIS server path.
Where PDF and XSL-FO output is saved
If a full path is not provided in the SaveAs command, the PDF and XSL-FO files that users generate from Web Forms DataWindow objects are saved by default in the virtual root path for IIS Web sites under the applicationName_root\File\Session\SessionID\currentInitialDirectory or the applicationName_root\File\User\UserName\currentInitialDirectory directory, where currentInitialDirectory is a directory that you assign at design time for the Web Forms application.
IIS server administrator role The IIS server administrator can change the default current initial directory by modifying the PBCurrentDirectory global property in the ASP.NET Configuration Settings dialog box or in the Web.Config file for the Web Forms application.
Using the Web Forms Print Manager
Print function support
In Web Forms applications, output from supported PowerScript print functions is published as PDF files on the server side. These PDF files are visible in the client-side Web browser through links in the Web Forms Print Manager, and they can be printed on the client side.
The following system print functions are supported in .NET Web Forms applications: Print, PrintCancel, PrintClose, PrintDefineFontDefine, PrintLine, PrintOpen, PrintOval, PrintPage, PrintRect, PrintRoundRect, PrintSetSpacing, PrintText, PrintWidth, PrintX, PrintY. PrintSetFont is also supported, but its return value is not the same as in a standard PowerBuilder application.
File operation output
You can use the DataWindow control's Print method to print a DataWindow object to a PDF file. Application users can open the PDF file in a separate browser instance by selecting the print result in the Print Manager. They can then print the PDF file using the File>Print menu of the browser.
You can also use the SaveAs method to print DataWindows and their data as PDF or XSL files. These files are not visible in the Print Manager. However, you can call the DownloadFile function (in a conditional compilation block) to download these files, or application users can download them from the server using the Web Forms File Manager and then print them from a local browser or Adobe Reader application.
For information on the DownloadFile function, see DownloadFile. For information on the File Manager, see "Using the Web Forms File Manager".
Print Manager icon display
When supported print functions are used to print text in a Web Forms application, a printer icon displays in the right-top corner of the main browser window.
Figure 5-1: Print icon on a Web Forms application
The application user can click the icon to open the Web Forms application Print Manager. The Print Manager lets the application user open a window to view the printed output as PDF files.
Figure 5-2 shows the Print Manager with hyperlinks to printed files.
Figure 5-2: Print Manager for a Web Forms application
If you do not want the Print Manager icon to display on a specific window in your application, you can set the HasPrintManager property for that window to false. The Print Manager icon automatically disappears on browser refresh after all the printed files are removed from the Print Manager window.
You can also code an application event to open the Print Manager by calling the OpenPrintManager function.
For information on the HasPrintManager property, see HasPrintManager. For information on the OpenPrintManager function, see OpenPrintManager.
Where printed output is saved
Printed output is saved to files in the applicationName_root\Print\Session\SessionID directory under the virtual root for IIS Web sites, or in the applicationName_root\Print\User\UserName directory if the current application user is logged in with a permanent user account profile. The applicationName_root\Print\Session and the applicationName_root\Print\User directories are created when you deploy your application. The SessionID or UserName directory is created by the ASP.NET runtime engine after a PrintOpen call.
The SessionID directory created under the Print\Session directory uses the same session ID number as the subdirectory created under the applicationName_root\File\Session directory when the user saves a DataWindow as a PDF or writes to a file from the current application session, or when the PBWebFileProcessMode global property has been set to Copy mode. The actual SessionID directory name is a long 24-character string with letters and numbers such as cdxgel554rkxxsbn1221uh55. Unless the user creating the printed files has logged in as a permanent user, the SessionID directories are deleted when the Web Forms session is ended.
Requirements for saving files in PDF or XSL format
The default PDF printing feature uses the Sybase DataWindow PS printer to print output to a PostScript (PS) file, and then convert it to a PDF file format. You must grant print permissions to the ASPNET, IIS_WPG, or IIS_IUSRS user group for the Sybase DataWindow PS printer.
Alternatively, you could use the Apache Formatting Objects (FO) processor to save a DataWindow and its data in the PDF or XSL-FO format.
PostScript printing method
The Sybase DataWindow PS printer profile is added automatically to a computer's printer list when you save a DataWindow to a PDF file from a PowerBuilder application. This does not occur automatically with a Web Forms application; however, Web Forms users can use the Sybase DataWindow PS printer that you create on the server computer from a standard client-server application at design time or runtime.
You can also add the Sybase DataWindow PS profile manually to the server computer using the Windows Add Printer wizard. If a PostScript driver has not been previously installed on the IIS server computer, the Add Printer wizard might ask you to insert the Windows installation CD.
Once a postscript driver is installed, you (or the server administrator) can add a Sybase DataWindow PS profile from the Install Printer Software page of the wizard in one of the following ways:
Click the Have Disk button and browse to the Adist5.inf file (installed with PowerBuilder) in the Shared\PowerBuilder\drivers directory, or to another PostScript driver file.
Select a printer with PS in its name (such as "Apple Color LW 12/660 PS") from the list of printers of the wizard.
You must then rename the printer to "Sybase DataWindow PS" on the Name Your Printer page of the Add Printer wizard or in the Properties dialog box for the added printer.
To enable PDF printing from a Web Forms application using the postscript processing method, you must also install Ghostscript on the IIS server computer.
For more information about installing Ghostscript, see "Installing GPL Ghostscript".
Apache FO processing method
If a Web Forms application uses the Apache processor to save a DataWindow and its data in PDF or XSL-FO format, you must include the fop-0.20.4 directory and the Java Runtime Environment (JRE) on the server computer. The bin\client folder of the JRE must be in the server computer's system path.
The processor directory and the JRE must be in the same path as the PowerBuilder runtime files. For example, if pbvm115.dll and the other PowerBuilder runtime files are included in a server computer directory called ServerPB, the Apache processor must be copied to ServerPB\fop-0.20.4 and the JRE to ServerPB\jre, respectively. However, you do not need to place a copy of the JRE in this location if the full JDK is installed on the server computer and is in its classpath.
The following JAR files must be in the server computer's classpath:
You might also need to restart the IIS server before you can use this method to print to a PDF file from a Web Forms application.
DBCS platforms If the Web Forms server computer is a DBCS platform, you also need to include a file that supports DBCS characters in the Windows font directory, for example, C:\WINDOWS\fonts. For more information about configuring fonts, see the Apache Web site .
Installing GPL Ghostscript
To enable Web Forms users to save their data in PDF format using the postscript processing method, you must download and install Ghostscript on the IIS server computer as described in the procedure that follows. Ghostscript is not required on the client for Web Forms applications.
The use of Ghostscript is subject to the terms and conditions of the General Public License (GPL). A copy of the GPL is available on the GNU Project Web server .