PdfFileEditor.AddMargins

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

Resizes page contents and add specifed margins. Margins are specified in default space units.

public bool AddMargins(Stream source, Stream destination, int[] pages, double leftMargin, 
    double rightMargin, double topMargin, double bottomMargin)
ParameterTypeDescription
sourceStreamStream which contains source document.
destinationStreamStream where resultant document will be saved.
pagesInt32[]Array of page indexes. If null then all document pages will be processed.
leftMarginDoubleLeft margin.
rightMarginDoubleRight margin.
topMarginDoubleTop margin.
bottomMarginDoubleBottom margin.

Return Value

true if operation was successful.

Examples

PdfFileEditor fileEditor = new PdfFileEditor();
Stream src = new Stream("input.pdf", FileMode.Open);
Stream dest = new Stream("output.pdf", FileMode.Create);
fileEditor.AddMargins(src, dest, 
    //process pages 1, 2, 3
    new int[] { 1, 2, 3}, 
    //left margin is 10 units
    10, 
    //right margin is 5 units
    5, 
    //top margin is 5 units
    5, 
    //bottom margin is 5 units
    5);
    dest.Close();

See Also


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

Resizes page contents and add specifed margins. Margins are specified in default space units.

public bool AddMargins(string source, string destination, int[] pages, double leftMargin, 
    double rightMargin, double topMargin, double bottomMargin)
ParameterTypeDescription
sourceStringPath to source document.
destinationStringPath where resultant document will be saved.
pagesInt32[]Array of page indexes. If null then all document pages will be processed.
leftMarginDoubleLeft margin.
rightMarginDoubleRight margin.
topMarginDoubleTop margin.
bottomMarginDoubleBottom margin.

Return Value

true if resize was successful.

Examples

PdfFileEditor fileEditor = new PdfFileEditor();
fileEditor.AddMargins("input.pdf", "output.pdf", 
    //process pages 1, 2, 3
    new int[] { 1, 2, 3}, 
    //left margin is 10 units
    10, 
    //right margin is 5 units
    5, 
    //top margin is 5 units
    5, 
    //bottom margin is 5 units
    5);

See Also