PdfFileEditor.ResizeContents
Contents
[
Hide
]ResizeContents(Stream, Stream, int[], ContentsResizeParameters)
Resizes contents of pages of the document.
public bool ResizeContents(Stream source, Stream destination, int[] pages,
ContentsResizeParameters parameters)
Parameter | Type | Description |
---|---|---|
source | Stream | Stream with source document. |
destination | Stream | Stream with the destination document. |
pages | Int32[] | Array of page indexes. |
parameters | ContentsResizeParameters | Resize parameters. |
Return Value
Returns true if success.
Examples
PdfFileEditor fileEditor = new PdfFileEditor();
Stream src = new Stream("input.pdf", FileMode.Open);
Stream dest = new Stream("output.pdf", FileMode.Create);
PdfFileEditor.ContentsResizeParameters parameters = new PdfFileEditor.ContentsResizeParameters(
//left margin = 10% of page width
PdfFileEditor.ContentsResizeValue.Percents(10),
//new contents width calculated automatically as width - left margin - right margin (100% - 10% - 10% = 80%)
null,
//right margin is 10% of page
PdfFileEditor.ContentsResizeValue.Percents(10),
//top margin = 10% of height
PdfFileEditor.ContentsResizeValue.Percents(10),
//new contents height is calculated automatically (similar to width)
null,
//bottom margin is 10%
PdfFileEditor.ContentsResizeValue.Percents(10)
);
fileEditor.ResizeContents(src, dest, new int[] { 1, 2,.3}, parameters);
dest.Close();
See Also
- class ContentsResizeParameters
- class PdfFileEditor
- namespace Aspose.Pdf.Facades
- assembly Aspose.PDF
ResizeContents(Stream, Stream, int[], double, double)
Resizes contents of document pages. Shrinks contents of page and adds margins. New size of contents is specified in default space units.
public bool ResizeContents(Stream source, Stream destination, int[] pages, double newWidth,
double newHeight)
Parameter | Type | Description |
---|---|---|
source | Stream | Stream which contains source document. |
destination | Stream | Stream where resultant document will be saved. |
pages | Int32[] | Array of page indexes. If null then all document pages will be processed. |
newWidth | Double | New width of page contents in default space units. |
newHeight | Double | New height of page contents in default space units. |
Return Value
True if resize was successful.
Examples
PdfFileEditor fileEditor = new PdfFileEditor();
Stream src = new Stream("input.pdf", FileMode.Open);
Stream dest = new Stream("output.pdf", FileMode.Create);
fileEditor.ResizeContents(src, dest,
//resize all pages of document
null,
//new contents width = 200
200,
//new contents height = 300
300);
// rest area of page will be empty
See Also
- class PdfFileEditor
- namespace Aspose.Pdf.Facades
- assembly Aspose.PDF
ResizeContents(string, string, int[], double, double)
Resizes contents of document pages. Shrinks contents of page and adds margins. New size of contents is specified in default space units.
public bool ResizeContents(string source, string destination, int[] pages, double newWidth,
double newHeight)
Parameter | Type | Description |
---|---|---|
source | String | Path to source document. |
destination | String | Path where resultant document will be saved. |
pages | Int32[] | Array of page indexes. If null then all document pages will be processed. |
newWidth | Double | New width of page contents in default space units. |
newHeight | Double | New height of page contents in default space units. |
Return Value
true if resize was successful.
Examples
PdfFileEditor fileEditor = new PdfFileEditor();
fileEditor.ResizeContents("input.pdf", "output.pdf",
//resize all pages of document
null,
//new contents width = 200
200,
//new contents height = 300
300);
// rest area of page will be empty
See Also
- class PdfFileEditor
- namespace Aspose.Pdf.Facades
- assembly Aspose.PDF
ResizeContents(string, string, int[], ContentsResizeParameters)
Resizes contents of pages in document. If page is shrinked blank margins are added around the page.
public bool ResizeContents(string source, string destination, int[] pages,
ContentsResizeParameters parameters)
Parameter | Type | Description |
---|---|---|
source | String | Source document path. |
destination | String | Destination document path. |
pages | Int32[] | Array of page indexes (page index starts from 1). |
parameters | ContentsResizeParameters | Parameters of page resize. |
Return Value
true if resize was successful.
Examples
PdfFileEditor fileEditor = new PdfFileEditor();
PdfFileEditor.ContentsResizeParameters parameters = new PdfFileEditor.ContentsResizeParameters(
//left margin = 10% of page width
PdfFileEditor.ContentsResizeValue.Percents(10),
//new contents width calculated automatically as width - left margin - right margin (100% - 10% - 10% = 80%)
null,
//right margin is 10% of page
PdfFileEditor.ContentsResizeValue.Percents(10),
//top margin = 10% of height
PdfFileEditor.ContentsResizeValue.Percents(10),
//new contents height is calculated automatically (similar to width)
null,
//bottom margin is 10%
PdfFileEditor.ContentsResizeValue.Percents(10)
);
fileEditor.ResizeContents("input.pdf", "output.pdf", new int[] { 1, 2, 3 }, parameters);
See Also
- class ContentsResizeParameters
- class PdfFileEditor
- namespace Aspose.Pdf.Facades
- assembly Aspose.PDF
ResizeContents(Document, int[], ContentsResizeParameters)
Resizes pages of document. Blank margins are added around of shrinked page.
public void ResizeContents(Document source, int[] pages, ContentsResizeParameters parameters)
Parameter | Type | Description |
---|---|---|
source | Document | Source document. |
pages | Int32[] | List of page indexes. |
parameters | ContentsResizeParameters | Resize parameters. |
Examples
PdfFileEditor fileEditor = new PdfFileEditor();
Document doc = new Document("input.pdf");
PdfFileEditor.ContentsResizeParameters parameters = new PdfFileEditor.ContentsResizeParameters(
//left margin = 10% of page width
PdfFileEditor.ContentsResizeValue.Percents(10),
//new contents width calculated automatically as width - left margin - right margin (100% - 10% - 10% = 80%)
null,
//right margin is 10% of page
PdfFileEditor.ContentsResizeValue.Percents(10),
//top margin = 10% of height
PdfFileEditor.ContentsResizeValue.Percents(10),
//new contents height is calculated automatically (similar to width)
null,
//bottom margin is 10%
PdfFileEditor.ContentsResizeValue.Percents(10)
);
fileEditor.ResizeContents(doc, new int[] { 1, 2, 3 }, parameters);
doc.Save("output.pdf");
See Also
- class Document
- class ContentsResizeParameters
- class PdfFileEditor
- namespace Aspose.Pdf.Facades
- assembly Aspose.PDF
ResizeContents(Document, ContentsResizeParameters)
Resizes pages of document. Blank margins are added around of shrinked page.
public void ResizeContents(Document source, ContentsResizeParameters parameters)
Parameter | Type | Description |
---|---|---|
source | Document | Source document. |
parameters | ContentsResizeParameters | Resize parameters. |
Examples
PdfFileEditor fileEditor = new PdfFileEditor();
Document doc = new Document("input.pdf");
PdfFileEditor.ContentsResizeParameters parameters = new PdfFileEditor.ContentsResizeParameters(
//left margin = 10% of page width
PdfFileEditor.ContentsResizeValue.Percents(10),
//new contents width calculated automatically as width - left margin - right margin (100% - 10% - 10% = 80%)
null,
//right margin is 10% of page
PdfFileEditor.ContentsResizeValue.Percents(10),
//top margin = 10% of height
PdfFileEditor.ContentsResizeValue.Percents(10),
//new contents height is calculated automatically (similar to width)
null,
//bottom margin is 10%
PdfFileEditor.ContentsResizeValue.Percents(10)
);
fileEditor.ResizeContents(doc, parameters);
doc.Save("output.pdf");
See Also
- class Document
- class ContentsResizeParameters
- class PdfFileEditor
- namespace Aspose.Pdf.Facades
- assembly Aspose.PDF