设置纸张边距
using IronPrint;

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

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

设置纸张边距

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

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

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

准备开始了吗?

NuGet 下载量 52,427版本:2026.11刚刚发布