設定紙張邊界
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剛剛發布