1. Tasks
  2. Manipulate PDF

Tasks

Manipulate PDF

This task manipulates PDF documents by performing operations such as rotation, cropping, resizing, quality adjustment, and grayscale conversion on specific pages or entire documents.

Use Cases

  • Rotating PDF pages that are not oriented correctly to allow for better viewing and processing.
  • Reducing PDF quality to reduce file size and optimize storage.
  • Cropping PDF pages to focus on specific regions of interest.
  • Resizing PDF pages to meet specific dimension requirements.
  • Converting PDF pages to grayscale for document processing or printing.
  • Processing specific pages or page ranges within a PDF document.

Basic usage

loading...

Parameters

files
required
object[]

An array of file objects. Each object contains file metadata.

Show child attributes
fileuuid
required
string

The unique identifier of the PDF file that should be manipulated.


pages
optional
string

Specifies which pages of the PDF to manipulate. Can be provided in multiple formats:

  • Single page: "1"
  • Multiple specific pages: "1,3,5"
  • Page range: "1-5"
  • Combination: "1,3-5,7,10-12"

If not specified, operations will be applied to all pages in the PDF.

Default: All pages


operations
required
object

An object containing the manipulation operations to perform on the PDF pages. You can specify one or more operations. Available operations:

Show child attributes

crop

optional
object

Crops the PDF pages to specified dimensions and offset.

  • width
    number
    - Width of the cropped area in pixels
  • height
    number
    - Height of the cropped area in pixels
  • x_offset
    number
    - Horizontal offset from the top-left corner in pixels
  • y_offset
    number
    - Vertical offset from the top-left corner in pixels

rotate

optional
object

Rotates the PDF pages by the specified degrees.

  • degrees
    number
    - Rotation angle in degrees (e.g., 90, 180, 270)

resize

optional
object

Resizes the PDF pages to specified dimensions.

  • width
    number
    - New width in pixels
  • height
    number
    - New height in pixels

adjust_quality

optional
object

Adjusts the PDF quality/compression level.

  • quality
    number
    - Quality level from 1-100, where 100 is highest quality

grayscale

optional
boolean

Converts the PDF pages to grayscale when set to true.


Result

loading...

Properties

manipulated_files
array

An array of file objects representing the manipulated PDF documents. Each object contains:

  • filename
    string
    - The filename of the manipulated PDF
  • originalname
    string
    - The original filename
  • fileuuid
    string
    - The unique identifier of the manipulated PDF file
  • contentType
    string
    - The MIME type of the document (application/pdf)

Examples

Rotate specific pages 90 degrees

Rotates pages 1, 2, and 3 of an uploaded PDF 90 degrees clockwise.

loading...

Reduce PDF quality for optimization

Reduces the PDF quality to 50% to decrease file size for all pages.

loading...

Crop and resize specific pages

Crops a specific region from pages 1 and 5 of a PDF and then resizes them.

loading...

Convert to grayscale for document processing

Converts pages 2 through 10 to grayscale and reduces quality for document processing workflows.

loading...

Multiple operations on specific pages

Applies multiple manipulation operations to pages 1, 3-5, and 8: rotation, cropping, resizing, quality adjustment, and grayscale conversion.

loading...

Rotate all pages in a PDF

Rotates all pages in the PDF 180 degrees without specifying a pages parameter.

loading...