以编程方式打印为PDF [英] Programmatically Print to PDF

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

问题描述

我有一个客户希望同时打印到PDF和物理打印机。他们不希望从PDF打印物理副本,这是我不知道的原因。我尝试将其保存为临时RTF文件,然后调用ShellExecute来打印到Adobe,但似乎无法正常工作。

I have a customer who wants to print to PDF and Physical printer at the same time. They don't want to print the physical copy from the PDF, why I don't know. I tried saving as a temporary RTF file and calling ShellExecute to print to Adobe but doesn't appear this works.

有人可以在没有第三方PDF库的情况下进行操作吗?从文件打印为PDF?

Does anyone have a way without a 3rd party PDF library to print to PDF from a file?

更新:为了澄清一点,用户正在使用动态文档创建者。他们在TRichEdit中在屏幕上看到预览文本,当前的打印方法是TRichEdit的打印命令(RichEdit.Print)。进行pdf的第一次尝试是通过将此丰富编辑的内容保存到temp.rtf文件中。

UPDATE: To clarify a bit the user is working with a dynamic document creator. They see preview text on the screen in a TRichEdit and the current print method is the TRichEdit's print command (RichEdit.Print). The first attempt to a pdf was by saving the contents of this rich edit to a temp.rtf file.

推荐答案

您可以使用我们的开源 SynPdf库可以将RichEdit内容导出到pdf文件中。

You can use our Open Source SynPdf library to export a RichEdit content into a pdf file.

请参见此论坛帖子中的示例代码。

它不需要安装任何打印机。它将允许轻松打印预览,自定义页脚和标头,附加标题或文本(如果需要)。

It won't require any printer to be installed. And it will allow easy print preview, custom footer & header, additional title or text, if needed.

这篇关于以编程方式打印为PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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