设置纸张边距
using IronPrint;

// Define custom margins (top, right, bottom, left) in millimeters
PrintSettings printSettings = new PrintSettings();
printSettings.PaperMargins = new Margins(20, 15, 20, 15);

Printer.Print("invoice.pdf", printSettings);
NuGet Download
PM > Install-Package IronPrint
设置纸张边距

设置纸张边距

Margins对象,该对象的四个参数分别表示上、右、下、左边距(单位:毫米)。 调整这些数值可控制页面各边缘处打印内容周围的空白区域大小。

当文档需要符合装订要求、信头定位或企业风格指南时,自定义页边距非常有用。 例如,增加左边距可适应打孔装订,而缩小边距则能最大化数据密集型报告的打印区域。 所有参数都会在渲染前传递给打印驱动程序,因此无论打印机的默认边距设置如何,输出结果都将符合您的规格要求。

探索 IronPrint 完整的纸张边距指南

准备开始了吗?

Nuget Downloads 49,171版本:2026.11刚刚发布