GET
/
transform

How to use

The page transformation allows you to select a specific page from a PDF document or a specific frame from an animated image (such as GIF).

Pass the following query param to the API endpoint:

page=num

Where:

  • num is the page number for PDFs or frame number for animated images.

For example: page=2

Parameter

num: The page or frame number to extract. This parameter accepts positive integer values:

  • For PDFs: Specifies the page number to extract.
  • For animated images: Specifies the frame number to extract.
  • The numbering starts from 1 (i.e., the first page or frame is 1, not 0).

Effect of Page Selection

  • For PDF documents: Extracts the specified page and converts it to an image.
  • For animated images: Extracts the specified frame as a static image.
  • If the specified page or frame number exceeds the available pages or frames, an error will be returned.

This transformation is useful for working with multi-page documents or animated images when you need to extract or display a specific part of the content.

Original PDF Document (example)

URL : https://www.thunderimage.com/sample/yosemite.pdf

Extracted Page 2 from PDF

URL: /transform?url=https://www.thunderimage.com/sample/yosemite.pdf&page=2

Original Animated GIF (example)

URL : https://www.thunderimage.com/sample/yosemite.gif

Extracted Frame 3 from Animated GIF

URL: /transform?url=https://www.thunderimage.com/sample/yosemite.gif&page=3

Best Practices

  • Ensure that you know the total number of pages or frames in your source file to avoid requesting non-existent pages/frames.
  • When working with PDFs, consider combining this transformation with other image transformations to adjust the extracted page (e.g., resizing, cropping).
  • For animated images, you can use this transformation to create thumbnails or previews of specific frames.
  • Remember that page numbers start at 1, not 0.

Note

The page transformation only works with multi-page documents (like PDFs) or multi-frame images (like animated GIFs). It will have no effect on single-page documents or static images.

Authorizations

x-api-key
string
headerrequired

API key required for authentication

Query Parameters

url
string
required

The URL of the PDF or animated image to be transformed.

page
integer

The page number for PDFs or frame number for animated images. Numbering starts from 1.

Required range: x > 1

Response

200 - image/jpeg

The extracted page or frame in JPEG format.