Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
You can change the document size by automatically scaling the content on its pages. You can scale the entire document or specific pages. There are three available methods:
bool PdfFileEditor.ResizeContents(string source, string destination, int[] pages, ContentsResizeParameters parameters)
void PdfFileEditor.ResizeContents(Document source, int[] pages, ContentsResizeParameters parameters)
void PdfFileEditor.ResizeContents(Document source, ContentsResizeParameters parameters)
The resize parameters are defined by the options class — PdfFileEditor.ContentsResizeParameters
.
A parameter container.
Properties:
ChangeMediaBox
: when enabled, the MediaBox is adjusted to the current CropBox during resizing.LeftMargin
, RightMargin
, TopMargin
, BottomMargin
: margins around the content (absolute or percentage).ContentsWidth
, ContentsHeight
: target content area size (absolute or percentage).Static configuration methods (create a new ContentsResizeParameters
object):
Margins(left, right, top, bottom)
: margins in absolute page units.MarginsPercent(left, right, top, bottom)
: margins in percentages.ContentSize(width, height)
: target content size in absolute units.ContentSizePercent(width, height)
: target content size in percentages.PageResize(width, height)
: change page size in absolute units.PageResizePct(widthPct, heightPct)
: change page size in percentages.You can create a ContentsResizeParameters
object using any of the static methods above and then additionally adjust its fields.
A universal container for a numeric parameter.
Value types:
Units
)Percents
)Auto
)Key fields/flags:
Value
: the numeric value.IsPercent
: indicates percentage interpretation; if false
— absolute value.Factory methods:
Units(value)
: create an absolute value.Percents(value)
: create a percentage value.Auto()
: mark the value for automatic calculation.Margins
or MarginsPercent
.ContentSize
or ContentSizePercent
.PageResize
or PageResizePct
.ChangeMediaBox
if you need to align page geometry: the MediaBox will be set to the current CropBox.Auto
when you want to delegate the calculation to the algorithm.Example of resizing a page
Increase page margins by 10% on all sides:
Set content size to 500 x 700 in page units and leave margins as auto:
Scale page by 120% width and 110% height:
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.