请教:虚拟打印机和后台打印的实现

C++语言 码拜 8年前 (2016-09-22) 1834次浏览
需求:
     开发一个虚拟打印机,提供给客户端使用。客户端使用这个虚拟打印机生成文档保存内打印容和设置好的打印选项(打印机选项和文档选项等)(这里称这些打印文档为虚拟打印结果)。
服务端要能够在后台将客户端提供的虚拟打印内容转移到真实打印机上打印出来。

实现思路
客户端上通过修改Printer Processor来开发虚拟打印机。得到两个文件,一个保存打印内容(.spl)(或直接保存成图片?),一个保存打印选项(.shd)。
服务端在后台使用win32 Api StartDoc之类的函数直接打印。
问题:
1、本人的实现思路有问题吗?又或有更好的实现思路,请指点。
1、客户端这块的spl文件据了解是用于生成emf文件所用,微软没有提供正式文档说明,虽然已经有很多代码来解析这个文件了,但是据说和真实打印的时候生成的还不一样。
2、.shd文件的格式本人没搜到什么说明啊,本人怎么样在服务端去解析这个文件来设置真实打印机的打印选项啊?又或本人该本人用文档去保存打印选项,然后再本人解析啊?
比较着急,在线等高手指导,谢谢了!
解决方案

5

这个东西有现成的,不需要搞开发,windows server的打印服务器能满足要求,还可以设置打印池,为每台打印机分配优先级,分配不同的权限等等。

45

引用:

这个东西有现成的,不需要搞开发,windows server的打印服务器能满足要求,还可以设置打印池,为每台打印机分配优先级,分配不同的权限等等。

请教:虚拟打印机和后台打印的实现

5

接上帖
nPropertyPages
Specifies the number of property page handles in the lphPropertyPages array.
lphPropertyPages
Contains an array of property page handles to add to the Print property sheet. The additional property pages follow the General page. Use the CreatePropertySheetPage function to create these additional pages. When the PrintDlgEx function returns, all the HPROPSHEETPAGE handles in the lphPropertyPages array have been destroyed. If nPropertyPages is zero, lphPropertyPages should be NULL.
nStartPage
Specifies the property page that is initially displayed. To display the General page, specify START_PAGE_GENERAL. Otherwise, specify the zero-based index of a property page in the array specified in the lphPropertyPages member. For consistency, it is recommended that the property sheet always be started on the General page.
dwResultAction
On input, set this member to zero. If the PrintDlgEx function returns S_OK, dwResultAction contains the outcome of the dialog. If PrintDlgEx returns an error, this member should be ignored. The dwResultAction member can be one of the following values.
PD_RESULT_APPLY
The user clicked the Apply button and later clicked the Cancel button. This indicates that the user wants to apply the changes made in the property sheet, but does not want to print yet. The PRINTDLGEX structure contains the information specified by the user at the time the Apply button was clicked.
PD_RESULT_CANCEL
The user clicked the Cancel button. The information in the PRINTDLGEX structure is unchanged.
PD_RESULT_PRINT
The user clicked the Print button. The PRINTDLGEX structure contains the information specified by the user.
Remarks
If both hDevMode and hDevNames are NULL, PrintDlgEx initializes the property sheet using the current default printer. To initialize the property sheet for a different printer, use the wDeviceOffset member of the DEVNAMES structure to specify the name of the printer.
Note that the dmDeviceName member of the DEVMODE structure also specifies a printer name. However, dmDeviceName is limited to 32 characters, and the wDeviceOffset name is not. If the wDeviceOffset and dmDeviceName names are not the same, PrintDlgEx initializes the property sheet using the printer specified by wDeviceOffset.
If the PD_RETURNDEFAULT flag is set and both hDevMode and hDevNames are NULL, PrintDlgEx uses the hDevNames and hDevMode members to return information about the current default printer without displaying the dialog box.
During the execution of PrintDlgEx, the DEVMODE and DEVNAMES structures that you specified in the PRINTDLGEX structure may not always contain current data. For this reason, application-specific property pages as well as IPrintDialogCallback routines for the initial page should use the IPrintDialogServices interface to retrieve information about the state of the current printer.
Structure Information
Header Declared in Commdlg.h, include Windows.h
Minimum operating systems Windows 2000
Unicode Implemented as ANSI and Unicode versions.
See Also
Common Dialog Box Library, CreatePropertySheetPage, DEVMODE, DEVNAMES, IPrintDialogCallback, IPrintDialogServices, PrintDlgEx

5

立思辰文档打印复印安全监控与审计系统

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明请教:虚拟打印机和后台打印的实现
喜欢 (0)
[1034331897@qq.com]
分享 (0)