PdfFileEditor.ResizeContentsPct

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

Resizes contents of document pages. Shrinks contents of page and adds margins. New contents size is specified in percents.

public bool ResizeContentsPct(Stream source, Stream destination, int[] pages, double newWidth, 
    double newHeight)
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.
newWidthDoubleNew width of page contents in percents.
newHeightDoubleNew height of page contents in percetns.

Return Value

true if resized sucessfully.

Examples

PdfFileEditor fileEditor = new PdfFileEditor();
Stream src = new Stream("input.pdf", FileMode.Open);
Stream dest = new Stream("output.pdf", FileMode.Create);
fileEditor.ResizePct(src, dest, 
//resize all pages of document
null, 
//new contents width = 60% of initial size
60, 
//new contents height = 60% of initial size
60);
// Rest area of page will be empty (page margins).  Size of left and right margins is (100% - 60%) / 2 = 20%
// The same for top and bottom margins.

See Also


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

Resizes contents of document pages. Shrinks contents of page and adds margins. New contents size is specified in percents.

public bool ResizeContentsPct(string source, string destination, int[] pages, double newWidth, 
    double newHeight)
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.
newWidthDoubleNew width of page contents in percents.
newHeightDoubleNew height of page contents in percetns.

Return Value

true if resize was successful.

Examples

PdfFileEditor fileEditor = new PdfFileEditor();
fileEditor.ResizePct("input.pdf", "output.pdf",
//resize all pages of document
null, 
//new contents width = 60% of initial size
60, 
//new contents height = 60% of initial size
60);
// Rest area of page will be empty (page margins).  Size of left and right margins is (100% - 60%) / 2 = 20%
// The same for top and bottom margins.

See Also