NET中从PrintDocument自动打印为PDF [英] Automating Print To PDF From PrintDocument In .NET

查看:535
本文介绍了NET中从PrintDocument自动打印为PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想自动将VB .NET PrintDocument导出为PDF(即无需任何用户交互).我一直在试图找到一个免费的PDF SDK(或类似的东西),让我能够做到这一点. 我尝试了几个免费的PDF打印机(Bullzip和CutePDF),当打印文档时,这两个打印机都会弹出一个保存对话框.我希望能够指定PDF的名称并通过代码保存位置,但是我认为这两种打印机都不能做到这一点.

I'd like to export a VB .NET PrintDocument to a PDF automatically (i.e. without the need for any user interaction). I've been trying to find a free PDF SDK (or something similar) that will allow me to do this. I've tried a couple of free PDF printers (Bullzip and CutePDF), both of which bring up a save dialog when the document is printed. I'd like to be able to specify the name of the PDF and save location via code, but I don't think that can be done with either of those printers.

很高兴听到人们面临同样的问题,过去所做的事情,包括付费选项.谢谢.

It would be good to hear what people facing the same issue have done in the past, paid-for options included. Thanks.

推荐答案

您可以安装BullZip并使用配置工具隐藏所有对话框,并将Pdf生成为预定义文件(所有打印请求的路径相同).

You can install BullZip and use the configuration tool to suppress all dialogs and generate the Pdf to a predefined file (same path for all print requests).

在代码中,在打印之前,请通过更改BullZip设置中的输出文件名来更新PDF打印机配置文件.更新PDF打印机配置文件C:\ Users \ user_name \ AppData \ Roaming \ PDF Writer \ Bullzip PDF Printer \ settings.ini(可能期望目录路径有所变化).

In your code, before printing, update the PDF printer configuration file by changing the output filename in the BullZip settings. Update the PDF printer configuration file C:\Users\user_name\AppData\Roaming\PDF Writer\Bullzip PDF Printer\settings.ini (one may expect variations on the directory path).

这篇关于NET中从PrintDocument自动打印为PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆