IRONSOFTWAREHOME
设置纸张边距
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);
Imports IronPrint

' Define custom margins (top, right, bottom, left) in millimeters
Dim printSettings As 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 46,090版本:2026.9刚刚发布

Key in blue circle

立即获取免费的 30 天试用版密钥

Your trial license will be sent to your email address

无任何限制。100% 解锁。无需信用卡。

bullet_checked无需信用卡或创建账户无任何限制。100% 解锁。无需信用卡。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
预约您的免费现场演示
Booking Badge

深受全球数百万工程师信赖

Iron Software 的客户徽标
获取您的无义务咨询
填写下面的表格或通过sales@ironsoftware.com
您的资料将始终保密。
深受全球数百万工程师信赖
Iron Software 的客户徽标
立即获取您的免费30 天试用密钥
无需信用卡或创建账户