AddMargins

AddMargins(string, string, int[], double, double, double, double)

调整页面内容的大小并添加指定的边距。 以默认空间单位指定边距。

public bool AddMargins(string source, string destination, int[] pages, double leftMargin, 
    double rightMargin, double topMargin, double bottomMargin)
范围类型描述
sourceString源文档的路径。
destinationString将保存结果文档的路径。
pagesInt32[]页面索引数组。如果为 null,则将处理所有文档页面。
leftMarginDouble左边距。
rightMarginDouble右边距。
topMarginDouble上边距。
bottomMarginDouble下边距。

返回值

如果调整大小成功,则为 true。

例子

PdfFileEditor fileEditor = new PdfFileEditor();
fileEditor.AddMargins("input.pdf", "output.pdf", 
    //处理第1、2、3页
    new int[] { 1, 2, 3}, 
    //左边距为10个单位
    10, 
    //右边距为5个单位
    5, 
    //上边距为5个单位
    5, 
    //下边距为5个单位
    5);

也可以看看


AddMargins(Stream, Stream, int[], double, double, double, double)

调整页面内容的大小并添加指定的边距。 以默认空间单位指定边距。

public bool AddMargins(Stream source, Stream destination, int[] pages, double leftMargin, 
    double rightMargin, double topMargin, double bottomMargin)
范围类型描述
sourceStream包含源文档的流。
destinationStream将保存结果文档的流。
pagesInt32[]页面索引数组。如果为 null,则将处理所有文档页面。
leftMarginDouble左边距。
rightMarginDouble右边距。
topMarginDouble上边距。
bottomMarginDouble下边距。

返回值

如果操作成功,则为 true。

例子

PdfFileEditor fileEditor = new PdfFileEditor();
Stream src = new Stream("input.pdf", FileMode.Open);
Stream dest = new Stream("output.pdf", FileMode.Create);
fileEditor.AddMargins(src, dest, 
    //处理第1、2、3页
    new int[] { 1, 2, 3}, 
    //左边距为10个单位
    10, 
    //右边距为5个单位
    5, 
    //上边距为5个单位
    5, 
    //下边距为5个单位
    5);
    dest.Close();

也可以看看