读书人

PB 调用PDFcreator 生成的PDF文件不能

发布时间: 2013-12-13 00:50:19 作者: rapoo

PB 调用PDFcreator 生成的PDF文件不能查找
各位大侠,
我用PB9,调用DW的 saveas的代码如下
dw_2.settransobject(sqlca)
dw_2.retrieve()
STRING ls_file_name
ls_file_name = 'test'
ChangeDirectory('C:\')
dw_2.Object.DataWindow.Export.PDF.Method = Distill!
dw_2.Object.DataWindow.Printer = "PDFCreator" //PDF Architect //PDFCreator
dw_2.Object.DataWindow.Export.PDF.Distill.CustomPostScript="Yes"
dw_2.SaveAs(ls_file_name, PDF!, true)

用到PDFCreator1.9,但是生成的PDF文件,不能查找;
复制其中的文字也是空白或者是乱码,能告诉我怎么回事么?
[解决办法]
FoxitPDFCreator31_x64_enu
是这个东西吗?我打印出来可以查找
[解决办法]
安装一个 PDF虚拟打印机pdfFactory 就能解决你的问题

或者你直接用pb12,支持dw直接saveas成pdf
[解决办法]
使用另存pdf,必须要这个东东


首先我要声明的是,这个方法在PB9+WIN7 64位下不好用。只适用于 PB12, 12.5。PB9的仍然得安装GhostScript 7.05,不能高于这个版本。

1,安装GhostScirpt 8.71

注意版本,高过这个版本就有时不好用。。

2,安装64位的PS打印机驱动程序,将打印机名称设置为 "Sybase DataWindow PS"

注意 打印机驱动可以选用HP的PS打印机。



别看我只写了这2条,我试验了1个星期!

如果自己下载不到,可以到下面这个地址下载去:(注意:要CSDN分)



GhostScirpt 8.71 & HP ps打印驱动



在PB的CS环境中,saveAS 是一般是没有问题的,如果在DW.NET的WEB条件下,调用SAVEas 是不好用的,主要原因是BS条件下,IIS对打印机没有操作权限,也因为权限问题,无法新建文件。经过查询DW.NET的帮助文档,发现按照下面文章所述,是可以进行dw.net的SAVEAS的。



在64位WIN下,DW.net save as PDF时,会提示-1的错误,保存不成功。其原因是:本地系统账号没有获得打印机权限。那么如何修改打印机权限呢?请按下面步骤:

(1) 当前用户在WEBSERVER的打印机需要先安装好。

(2) 在“开始”、“运行”中,运行注册表编辑器:regedit。

(3) 选择HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion, 将之导出为一个注册表备份文件,这个备份文件是以防万一改错了恢复用的。。

(4) 选择HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion,

a) 选择Devices子键,导出文件,文件名为device.reg

b) 选择PrinterPorts子键,导出文件,文件名为Printports.reg

c) 选择Windows子键,导出文件,文件名为Windows.reg

(5) 用记事本或者其他的文本编辑器,

a) 编辑device.reg文件,将HKEY_CURRENT_USER替换成HKEY_USERS\.DEFAULT

b) 编辑Printports.reg文件,将HKEY_CURRENT_USER替换成HKEY_USERS\.DEFAULT

c) 编辑Windows.reg文件,将HKEY_CURRENT_USER替换成HKEY_USERS\.DEFAULT

(6) 保存着3个文件后,双击这3个文件,将注册表内容导入到系统中。

(7) 重启IIS和WEBSITE使配置生效。





====以下英文文档可以不看,大部分是废话,按上面的方法设置打印机权限部分即可。========



If your DataWindow .NET application specifies a path for dynamically generated files, make sure that the ASP.NET account (or, for Windows 2003 server, the IIS_WPG user group) has write permission to the directories. You need to do this if your application uses graphs in Web DataWindows or saves the JavaScript, XML, XSLT, and CSS files generated for XML or XHTML Web DataWindows into separate directories.



The Web server must be configured so that the ASP.NET worker process has access to system settings and the SYSTEM account has access to printers. Implementing server-side printing requires changing the default permissions on the server.



By default, the .NET Framework runs with the permissions of the local “machine” account. In order to print using IIS, the .NET Framework must run with the permissions of the local “SYSTEM” account. The procedures for configuring the .NET Framework for IIS 5.x and 6.x are different.



To configure the .NET Framework to run with local SYSTEM settings with



IIS 6.x:

1 In the Windows Start>Run box, type InetMgr.

2 In the IIS Manager, expand local computer and select Application Pools.

3 Right-click Application Pools and select Properties.

4 Click the Identity tab, select Local System from the Predefined list box,

and click OK.

5 Click Yes in the pop-up warning message window that displays.

6 Right-click local computer and select All Tasks>Restart IIS to restart IIS.



Exposing printer settings to the SYSTEM account



When a printer is installed on a computer, its settings are stored in the HKEY_CURRENT_USER registry key. IIS runs under the context of the local SYSTEM account. It has access to the HKEY_USERS registry key, but not to the HKEY_CURRENT_USERS subkey, which is only available to a user logged on to the computer.



By default, no printers are defined in the HKEY_USERS key. You can add them by exporting three keys from the HKEY_CURRENT_USERS key and importing them to the HKEY_USERS key.



注意:

Incorrectly editing the registry might severely damage your system. Make sure you back up valued data before making changes to the registry.

先备份注册表.



To make printer settings available to the SYSTEM account:

1 Check that the current user on the Web server has the required printer(s) installed.

2 To launch the Registry Editor, type regedit in the Start>Run dialog box and click OK.

3 Select the HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion key and export the registry key from the File or Registry menu.

4 Specify a name and location in the Export Registry File dialog box and

click Save. This file provides a backup if you need to restore the registry.

5 In the HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion key, select the Devices subkey and export the registry key.

6 Specify the name devices.reg and a temporary location in the Export Registry File dialog box and click Save.

7 Repeat steps 5 and 6 for the PrinterPorts and Windows subkeys, naming the files printerports.reg and windows.reg.

8 Open devices.reg in Notepad (do not use TextPad or another editor), replace the string HKEY_CURRENT_USER with the string HKEY_USERS\.DEFAULT (note that there is a dot before DEFAULT), and save the file.

9 Repeat step 8 for printerports.reg and windows.reg.

10 Double-click each of the edited files to import them into the registry.

11 Restart IIS so that the configuration changes take effect.



To restart IIS:

1 In the Windows Start>Run box, type InetMgr.

2 In the IIS Manager, right-click the local computer and select All Tasks>Restart IIS.

3 In the Start/Stop/Reboot dialog box, select Restart Internet Services on ComputerName, where ComputerName is the local computer.



After restarting IIS, you need to restart the Web site.



DW保存PDF(saveas)必须满足如下要求:

(1)Configure the .NET Framework to run under the SYSTEM account and expose printer settings to the SYSTEM account as described in “Serverside printing” on page 208.

(2)Make sure that the Sybase DataWindow PS profile is exposed to the SYSTEM account as described next.

(3)Create a folder on the server in which to save the PDF files and set its permissions so that the ASP.NET application process has write access to it.





On Windows 2003 Server, a default Group Policy disallows installation of printers that use kernel-mode drivers, and as a result the driver used by the Sybase DataWindow PS profile is not installed. 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.msc and click OK.
In the Group Policy console, expand Computer Configuration, Administrative Templates, and Printers.
Disable “Disallow Installation of Printers Using Kernel-Mode Drivers.”
[解决办法]
Ghostscript

Ghostscript是一套建基于Adobe、PostScript及可移植文档格式(PDF)的页面描述语言等而编译成的免费软件。
目录
1基本信息
2软件发展
3软件特色
4软件用途
1基本信息


Ghostscript是一套建基于Adobe、PostScript及可移植文档格式(PDF)的页面描述语言等而编译成的免费软件。
Ghostscript最初是以商业软件形式在PC市场上发售,并称之为“GoScript”。但由于速度太慢(半小时一版A4),销量极差。后来有心人买下了版权,并改在Linux上开发,成为了今日的Ghostscript。
已经从Linux版本移植到其他操作系统,如其他Unix、Mac OS X、VMS、Windows、OS/2和Mac OS classic。
2软件发展

Ghostview 最早是由 L. Peter Deutsch和阿拉丁企业开发的,以Aladdin Free Public License(AFPL)发布,由artofcode LLC拥有并维护。推出了两个版本:一是在原来的AFPL许可下进行商业使用的AFPL Ghostscript,一是GNU General Public License 下使用的GPL Ghostscript。
GPL版本也是Display Ghostscript的基础,其增加了所需的功能,以便对 Display PostScript形成完全的支持。
3软件特色

这个软件的配置功能很好,可用作:
计算机打印机使用的栅格化图像处理器(RIP),例如,行打印机Daemon的输入过滤器。
以PostScript和PDF阅览器使用的栅格化图像

处理器(RIP)引擎。
文件格式转换器,如PostScript和PDF转换器。
一般用途的编程环境。
Ghostscript是一套与PostScript相容的软体。最初是以商业软体形式在PC市场上发售,并称之为“GoScript”。
现在已经从Linux版本翻版到其他操作系统,如其他Unix、Mac OS X、VMS、Windows、OS/2和Mac OS classic。
已经写出几个图形用户界面(GUI)用于让用户在屏幕上观看PostScript或PDF文件,可以上下卷动、向前翻页、向后翻页、缩放文字,而且还能打印一页或多个页面。
Ghostview,在Unix/X11下运行。
GSView,在Windows和OS/2下运行。
Ghostview最早是由L. Peter Deutsch和Aladdin Enterprises开发的,以Aladdin Free PublicLicense (AFPL)发布,目前由artofcode LLC拥有并维护。推出了两个版本:一是在原来的AFPL许可下进行商业使用的AFPL Ghostscript,一是GNU General Public License下使用的GPL Ghostscript。
GPL版本也是Display Ghostscript的基础,其增加了所需的功能,以便对Display PostScript形成完全的支持。
4软件用途

这个软体可用作:
◆电脑印表机使用的栅格化影像处理器(RIP)
◆以Postscript和PDF阅览器使用的栅格化影像处理器(RIP) 引擎。
◆档案格式转换器
◆一般用途的编程环境

读书人网 >PB

热点推荐