简体   繁体   English

如何打印PDFsharp PdfDocument对象?

[英]How to print PDFsharp PdfDocument object?

PdfDocument class in PDFsharp does not have any type of print method neither does the PDFsharp PdfFilePrinter class ctor's accept any PdfDocument object. PDFsharp中的PdfDocument类没有任何类型的打印方法,PDFsharp PdfFilePrinter类ctor也不接受任何PdfDocument对象。

ms = new MemoryStream();
using (FileStream fs = File.OpenRead(path))
{
    fs.CopyTo(ms);
}

document = new PdfDocument();
document = PdfReader.Open(ms);

So can anybody provide me solution to print my document object? 那么有人可以为我提供打印我的文档对象的解决方案吗?

PdfFilePrinter just calls Adobe Reader to print the PDF file. PdfFilePrinter只是调用Adobe Reader来打印PDF文件。 So you need a file and cannot pass a PdfDocument. 因此,您需要一个文件,并且无法传递PdfDocument。

Judging from your sample code you already have a file. 从示例代码来看,您已经有一个文件。 No need to read this file into a PdfDocument object if you only want to print it. 如果只想打印该文件,则无需将该文件读入PdfDocument对象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM