如何从 vb.net 生成准备打印的 pdf 文档 [英] How do I generate a pdf document from vb.net ready for printing

查看:44
本文介绍了如何从 vb.net 生成准备打印的 pdf 文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的任务是开发用于生成账单的软件.我已经创建了数据库,我已经在 VB.NET 中创建了前端,但是,主要问题是打印表单上显示的数据.该表单包含一些标签、增值税、小计和总计费金额.它还显示 DataGridView 中的项目列表.如何生成 pdf 并将表单打印为客户的帐单(不包括按钮)?

我附上一张图片,让您了解表单的外观:

解决方案

使用 PrintForm 组件.

<块引用>

将表单打印到默认打印机

  1. 在工具箱中,单击 Visual Basic PowerPacks 选项卡,然后将 PrintForm 组件拖到表单上.
  2. PrintForm 组件已添加到组件托盘中.
  3. 在属性"窗口中,将 PrintAction 属性设置为 PrintToPrinter.
  4. 在适当的事件处理程序中添加以下代码(例如,在打印按钮的 Click 事件处理程序中).

来自 http://msdn.microsoft.com/en-us/图书馆/bb629268.aspx

如果你想先删除按钮:

myButton.Visible = False

然后继续打印表格.

I have been assigned the task to develop a software for generating bills. I have created the database, i have created the front end in VB.NET, but, the main problem is printing the data displayed on the form. The form contains some labels, the VAT, the sub total and the total billed amount. It also displays the list of items in a DataGridView. How can I generate a pdf and print the form as a bill for the customer(without including the buttons)?

I am attaching an image to give you an idea about how the form looks like:

解决方案

Use the PrintForm component.

To print a form to the default printer

  1. In the Toolbox, click the Visual Basic PowerPacks tab and then drag the PrintForm component onto the form.
  2. The PrintForm component is added to the component tray.
  3. In the Properties window, set the PrintAction property to PrintToPrinter.
  4. Add the following code in the appropriate event handler (for example, in the Click event handler for a Print Button).

From http://msdn.microsoft.com/en-us/library/bb629268.aspx

If you want to remove the buttons first :

myButton.Visible = False

Then proceed to print the form.

这篇关于如何从 vb.net 生成准备打印的 pdf 文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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