PdfFileEditor.AddMarginsPct

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

Resizes page contents and add specified margins. Margins are specified in percents of intitial page size.

public bool AddMarginsPct(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 in percents of initial page size.
rightMarginDoubleRight margin in percents of initial page size.
topMarginDoubleTop margin in percents of initial page size.
bottomMarginDoubleBottom margin in percents of initial page size.

Return Value

true if action was performed successfully.

Examples

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

See Also


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

Resizes page contents and add specified margins. Margins are specified in percents of intitial page size.

public bool AddMarginsPct(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 in percents of initial page size.
rightMarginDoubleRight margin in percents of initial page size.
topMarginDoubleTop margin in percents of initial page size.
bottomMarginDoubleBottom margin in percents of initial page size.

Return Value

true if resize was successful

Examples

PdfFileEditor fileEditor = new PdfFileEditor();
fileEditor.AddMarginsPct("input.pdf", "output.pdf", 
    //process pages 1, 2, 3
    new int[] { 1, 2, 3}, 
    //left margin is 15% of page width 
    15, 
    //right margin is 10% of page width
    10, 
    //top margin is 20% of page width
    20, 
    //bottom margin is 5% of page width
    5);

See Also