Skip to content
English
  • There are no suggestions because the search field is empty.

[Public] Understanding PDF Page Manipulation: Extend, Resize, and Transform

Definition and use cases of these methods

 

When working with PDF files programmatically—especially for layout adjustments—it's crucial to understand how different operations affect the page itself and the content within it. In this article, we'll break down and compare three important methods used to manipulate PDF pages:

  • Resize
  • Extend

  • Transform

Each of these serves a distinct purpose, and choosing the right one depends on whether you want to change page size, page margins, or how content appears.

 

1. Resize — Change the Page Dimensions

public void Resize(double PageWidth, double PageHeight, MeasurementUnit Units)

 

Use when:

You want to change the page size itself—either enlarging or shrinking it.

 

Key behavior:

  • Changes the physical size of the page.

  • Resizes the content to fit in the new size of the page.

Example:

If a page is originally 210mm x 297mm, and you run:

Screenshot 2025-07-04 112345

 

The output page size is 148mm x 210mm (A5 size) and the content is fitted into the new size of the page so that all is visible in the output.

 

2. Extend — Add Margins Without Changing Content

 
public void Extend(double ExtendLeft, double ExtendRight, double ExtendTop, double ExtendBottom, MeasurementUnit Units)

 

Use when:

You want to add whitespace/margins around existing content without altering the content's layout, scale, or position.

 

Key behavior:

  • Does not resize or reposition existing content.

  • Adds extra space to the page—effectively increasing page size.

  • Can be used to prepare a PDF for printing or binding where extra margins are needed.

Example:

If a page is 210mm x 297mm (A4) and you run:

Screenshot 2025-07-04 111051 

 

Sample input

Screenshot 2025-07-04 112622

Sample output

Screenshot 2025-07-04 112701

The new page size becomes:

  • Width: 230mm (adds 10mm left and 10mm right)

  • Height: 337mm (adds 20mm top and 20mm bottom)

But the content stays exactly where it was—centered in its original space, with margins around it.

 

3. Transform — Move or Scale Page Content

 

public void Transform(double MoveX, double MoveY, double ScaleX, double ScaleY)

 

Use when:

You want to move or scale the actual content on the page—without changing the physical size of the page.

 

Key behavior:

  • Keeps page size the same.

  • Modifies how content appears: shifts position and/or scales it.

  • Useful for layout corrections, zooming, or shifting content into view.

Example:

 

Screenshot 2025-07-04 111508

Sample input

Screenshot 2025-07-04 112701

Sample output

Screenshot 2025-07-04 112726

 
  • Moves content right 10mm and down 5mm

  • Scales content down to 80% of its original size in both directions

This is a powerful tool for adjusting layouts, aligning content, or applying effects like zoom-out. 

 

Final Thoughts

Understanding these three methods helps avoid unexpected results when programmatically modifying PDFs:

  • Use Resize to change page size, being careful with content clipping.

  • Use Extend to increase canvas size with whitespace.
  • Use Transform to move or scale content, keeping the page dimensions fixed.

Each plays a unique role in document formatting, and in many cases, you may use them in combination—for example, resizing the page and then transforming the content to fit.