iText 9.4.0 API
iText.Kernel.Pdf.PageResizer Class Reference

The PageResizer class provides functionality to resize PDF pages to a specified target page size using various resizing methods. More...

Public Types

enum   ResizeType { MAINTAIN_ASPECT_RATIO, DEFAULT }
  Enum representing the available types of resizing strategies when modifying the dimensions of a PDF page. More...
 
enum   VerticalAnchorPoint { TOP, CENTER, BOTTOM }
  Represents the vertical alignment points used for resizing or aligning elements, particularly in the context of page rescaling. More...
 
enum   HorizontalAnchorPoint { LEFT, CENTER, RIGHT }
  Enum representing the horizontal anchor point used in the resizing and alignment of a page or content. More...
 

Public Member Functions

  PageResizer (PageSize size, PageResizer.ResizeType type)
  Constructs a new PageResizer instance with the specified page size and resize type. More...
 
virtual PageResizer.HorizontalAnchorPoint  GetHorizontalAnchorPoint ()
  Retrieves the horizontal anchor point of the PageResizer. More...
 
virtual void  SetHorizontalAnchorPoint (PageResizer.HorizontalAnchorPoint anchorPoint)
  Sets the horizontal anchor point, which determines how the horizontal alignment is handled (e.g., LEFT, CENTER, RIGHT). More...
 
virtual PageResizer.VerticalAnchorPoint  GetVerticalAnchorPoint ()
  Retrieves the vertical anchor point of the PageResizer. More...
 
virtual void  SetVerticalAnchorPoint (PageResizer.VerticalAnchorPoint anchorPoint)
  Sets the vertical anchor point, which determines how the vertical alignment is handled (e.g., TOP, CENTER, BOTTOM). More...
 
virtual void  Resize (PdfPage page)
  Resizes a given PDF page based on the specified dimensions and resize type. More...
 

Detailed Description

The PageResizer class provides functionality to resize PDF pages to a specified target page size using various resizing methods.

The PageResizer class provides functionality to resize PDF pages to a specified target page size using various resizing methods. It adjusts page dimensions, content, annotations, and resources accordingly, also supports configuration options for maintaining the aspect ratio during the resize operation.

Member Enumeration Documentation

◆ HorizontalAnchorPoint

Enum representing the horizontal anchor point used in the resizing and alignment of a page or content.

Enum representing the horizontal anchor point used in the resizing and alignment of a page or content.

The horizontal anchor point specifies the horizontal alignment, determining the reference point for positioning during resizing operations. Possible values include:

  • LEFT

◆ ResizeType

Enum representing the available types of resizing strategies when modifying the dimensions of a PDF page.

Enum representing the available types of resizing strategies when modifying the dimensions of a PDF page. These strategies determine how the content is scaled relative to the new size.

◆ VerticalAnchorPoint

Represents the vertical alignment points used for resizing or aligning elements, particularly in the context of page rescaling.

Represents the vertical alignment points used for resizing or aligning elements, particularly in the context of page rescaling.

The available anchor points are:

  • TOP: The top edge of the element serves as the reference point for alignment.
  • CENTER: The center of the element is used as the alignment reference.
  • BOTTOM: The bottom edge of the element serves as the reference point for alignment.

This enumeration is employed by the PageResizer class to determine the vertical alignment of content during resizing operations.

Constructor & Destructor Documentation

◆ PageResizer()

iText.Kernel.Pdf.PageResizer.PageResizer ( PageSize  size,
PageResizer.ResizeType  type 
)
inline

Constructs a new PageResizer instance with the specified page size and resize type.

Parameters
size the target page size to which the content should be resized
type the resizing method to be applied, such as maintaining the aspect ratio

Member Function Documentation

◆ GetHorizontalAnchorPoint()

virtual PageResizer.HorizontalAnchorPoint iText.Kernel.Pdf.PageResizer.GetHorizontalAnchorPoint ( )
inlinevirtual

Retrieves the horizontal anchor point of the PageResizer.

Returns
the horizontal anchor point, which determines the horizontal alignment (e.g., LEFT, CENTER, RIGHT).

◆ GetVerticalAnchorPoint()

virtual PageResizer.VerticalAnchorPoint iText.Kernel.Pdf.PageResizer.GetVerticalAnchorPoint ( )
inlinevirtual

Retrieves the vertical anchor point of the PageResizer.

Returns
the vertical anchor point, which determines the vertical alignment (e.g., TOP, CENTER, BOTTOM).

◆ Resize()

virtual void iText.Kernel.Pdf.PageResizer.Resize ( PdfPage  page )
inlinevirtual

Resizes a given PDF page based on the specified dimensions and resize type.

Resizes a given PDF page based on the specified dimensions and resize type. Depending on the resize type, the aspect ratio may be maintained during scaling. Updates the page's content, annotations, and resources to reflect the new size.

Parameters
page the PDF page to be resized

◆ SetHorizontalAnchorPoint()

virtual void iText.Kernel.Pdf.PageResizer.SetHorizontalAnchorPoint ( PageResizer.HorizontalAnchorPoint  anchorPoint )
inlinevirtual

Sets the horizontal anchor point, which determines how the horizontal alignment is handled (e.g., LEFT, CENTER, RIGHT).

Parameters
anchorPoint the horizontal anchor point to set; it specifies the horizontal alignment type for resizing operations

◆ SetVerticalAnchorPoint()

virtual void iText.Kernel.Pdf.PageResizer.SetVerticalAnchorPoint ( PageResizer.VerticalAnchorPoint  anchorPoint )
inlinevirtual

Sets the vertical anchor point, which determines how the vertical alignment is handled (e.g., TOP, CENTER, BOTTOM).

Parameters
anchorPoint the vertical anchor point to set; it specifies the vertical alignment type for resizing operations