VB.NET PrintDialog类打印到文件文件、VB、NET、PrintDialog

2023-09-06 18:10:11 作者:氧气i

我使用.NET(VB),图形打印在pre定义的格式(如纳税申报表),这只是罚款/ preVIEW报告。

I am using .NET (VB) Graphics to print/preview reports in a pre-defined format (like tax forms), which works just fine.

我也希望能有积累的一个或多个不同的报告,并将其保存到后来的转换文件为PDF或使用XPS打印驱动程序打印它们的能力。

I would also like to be able to have the ability to accumulate one or more different reports and save them to a file for later conversion to PDF or to use the XPS print driver to print them.

当我选中打印到文件对话框(对于一个普通的激光打印机或XPS打印驱动程序),然后点击打印,我没有得到一个打开文件对话框,本文建议我应该(的 http://www.functionx.com/vcnet/controls/print.htm )。该操作似乎正常进行,但我不知道在哪里可以找到这个文件,如果事实上创建一个。

When I check the "print to file" box (for a regular laser printer or the XPS print driver), and click "Print", I do not get an Open File dialog as this article suggests I should ( http://www.functionx.com/vcnet/controls/print.htm ). The operation seems to proceed normally, but I have no idea where to find the file, if in fact one is created.

我在想什么?任何人都可以提供累积图形报告和印刷或打印到文件的另一种方法?

What am I missing? Can anyone offer an alternative method of accumulating Graphics reports and printing or printing to a file?

TIA的时间。

推荐答案

在打印对话框竟与PrintDocument的实例相关联? code这样的效果很好:

Is the print dialog actually associated with the PrintDocument instance? Code like this works well:

    private void button1_Click(object sender, EventArgs e) {
        printDocument1.PrinterSettings.PrintToFile = true;
        printDocument1.PrinterSettings.PrintFileName = @"c:\temp\test.xps";
        printDocument1.Print();
    }
 
精彩推荐
图片推荐