Printing PDFs from Network Printers

This article was translated from English: Does it need improvement?
Translated
View the article in English
role="alert">IronPrint 是 Iron Software 全新的 .NET 打印库,提供跨广泛平台的兼容性,包括 Windows、macOS、Android 和 iOS。立即开始使用 IronPrint

如何使用 IronPDF 从网络打印机打印?

IronPDF 支持 C# 可用的所有打印选项。

发送到默认打印机:

使用 Print 方法将 PDF 发送到默认打印机。

IronPdf.PdfDocument.Print(System.Boolean)

// C# example of sending a PDF document to the default printer
using IronPdf;

var pdf = PdfDocument.FromFile("example.pdf");

// Sends the document to the default printer
pdf.Print(showPreview: false); // set `showPreview` to true to see a preview before printing
// C# example of sending a PDF document to the default printer
using IronPdf;

var pdf = PdfDocument.FromFile("example.pdf");

// Sends the document to the default printer
pdf.Print(showPreview: false); // set `showPreview` to true to see a preview before printing
' C# example of sending a PDF document to the default printer
Imports IronPdf

Private pdf = PdfDocument.FromFile("example.pdf")

' Sends the document to the default printer
pdf.Print(showPreview:= False) ' set `showPreview` to true to see a preview before printing
$vbLabelText   $csharpLabel

发送到指定名称的打印机:

使用重载的 Print 方法通过名称指定打印机。

IronPdf.PdfDocument.Print(System.String, System.Boolean)

// C# example of sending a PDF document to a specific printer by name
using IronPdf;

var pdf = PdfDocument.FromFile("example.pdf");
string printerName = "MyNetworkPrinter";

// Sends the document to the specified printer
pdf.Print(printerName, showPreview: false);
// C# example of sending a PDF document to a specific printer by name
using IronPdf;

var pdf = PdfDocument.FromFile("example.pdf");
string printerName = "MyNetworkPrinter";

// Sends the document to the specified printer
pdf.Print(printerName, showPreview: false);
' C# example of sending a PDF document to a specific printer by name
Imports IronPdf

Private pdf = PdfDocument.FromFile("example.pdf")
Private printerName As String = "MyNetworkPrinter"

' Sends the document to the specified printer
pdf.Print(printerName, showPreview:= False)
$vbLabelText   $csharpLabel

发现打印机:

要将文档发送到特定的打印机,请确保该打印机已被“发现”。

对于 AirPrint:

如果使用 AirPrint,请尝试以下建议:

您也可以尝试: PdfDocument.GetPrintDocument()PdfDocument.Print 重载,它们显示打印预览窗口,并且如果有可用的,将允许选择 AirPrint。

Curtis Chau
技术作家

Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。

除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。

准备开始了吗?
Nuget 下载 16,154,058 | 版本: 2025.11 刚刚发布