Click or drag to resize
Pdf Library for .NET

PdfResizeManager Class

Resizes existing pdf documents — change the page size, orientation or margins, and scale / align the original page content into the new page.
Inheritance Hierarchy
SystemObject
  SelectPdf.UniversalPdfResizeManager

Namespace: SelectPdf.Universal
Assembly: SelectPdf.Universal (in SelectPdf.Universal.dll) Version: 26.4
Syntax
public class PdfResizeManager

The PdfResizeManager type exposes the following members.

Constructors
 NameDescription
Public methodPdfResizeManagerInitializes a new instance of the PdfResizeManager class.
Top
Properties
 NameDescription
Public propertyAllowScaleWhether the content may be scaled to fit. Default true.
Public propertyContentSizeThe size of the content in the resized page.
Public propertyHorizontalAlign Horizontal alignment of the content in the page — honored only when the content is placed at the origin, scaling is allowed and the aspect ratio is preserved.
Public propertyKeepAspectRatioWhether the content aspect ratio is preserved when scaling. Default true.
Public propertyKeepOriginalPageSettings When true, each page keeps its original size and orientation instead of using PageSize / PageOrientation, and the resized document keeps the loaded document's security. Default false.
Public propertyPageMarginsThe resized document page margins. Default 0 on every side.
Public propertyPageOrientationThe resized document page orientation. Defaults to the loaded document's first-page orientation.
Public propertyPageSizeThe resized document page size. Defaults to the loaded document's first-page size.
Public propertyCode exampleSecurity Gets the security settings of the resized document - passwords, permissions and encryption.
Public propertyStartPositionThe start position of the content in the resized page.
Public propertyVerticalAlign Vertical alignment of the content in the page — honored only when the content is placed at the origin, scaling is allowed and the aspect ratio is preserved.
Public propertyCode exampleViewerPreferences Gets the viewer preferences of the resized document.
Top
Methods
 NameDescription
Public methodCloseCloses the loaded document and releases its resources.
Public methodGetDocumentResizes and returns the result as a new PdfDocument.
Public methodLoad(Byte)Loads a pdf document from a byte array.
Public methodLoad(PdfDocument)Loads an existing PdfDocument.
Public methodLoad(Stream)Loads a pdf document from a stream.
Public methodCode exampleLoad(String)Loads a pdf document from a file.
Public methodLoad(Byte, String)Loads a password-protected pdf document from a byte array.
Public methodLoad(PdfDocument, String)Loads an existing PdfDocument with a password.
Public methodLoad(Stream, String)Loads a password-protected pdf document from a stream.
Public methodLoad(String, String)Loads a password-protected pdf document from a file.
Public methodSaveResizes and returns the document bytes.
Public methodSave(Stream)Resizes and saves the document to a stream.
Public methodCode exampleSave(String)Resizes and saves the document to a file.
Top
Remarks
Load a document, configure the geometry, then Save(String) / GetDocument. Each source page is drawn scaled and aligned onto a new page. The resized document keeps what the loaded document carries beyond its pages: annotations, links, form fields, bookmarks, named destinations, the open action, page labels, attachments, document information, viewer preferences and XMP metadata, with every page reference and coordinate remapped to the resized geometry.
Example
PdfResizeManager manager = new PdfResizeManager();
manager.Load("a4.pdf");
manager.PageSize = PdfCustomPageSize.Letter;
manager.PageMargins = new PdfMargins(36);
manager.Save("letter.pdf");
manager.Close();
See Also