PDF Transformation

PDF manipulation is a crucial functionality provided by FastPDF — it allows the conversion, merging, splitting, compression, metadata editing and other transformations of PDF files suitable for various use-cases. On this page, we'll examine the wide array of PDF transformation endpoints that you can use to manipulate PDFs programmatically. We will cover how to perform different transformations, such as converting from and to PDF, merging and splitting PDFs, and much more.


POST/v1/pdf/merge

Merge PDFs

This endpoint allows you to merge multiple PDF files into one.

Required attributes

  • Name
    file_paths
    Type
    Array of Files
    Description

    The paths to the PDF files to be split, or the PDFs bytes.

Request

POST
/v1/pdf/merge
curl -X POST https://data.fastpdfservice.com/v1/pdf/merge \
  -H "Authorization: {token}" \
  -F "file1=@path/to/first.pdf" \
  -F "file2=@path/to/second.pdf"

POST/v1/pdf/split

Split PDF

This endpoint allows you to split a PDF file at the given pages, and return the result PDF.

Required attributes

  • Name
    file
    Type
    File
    Description

    The path to the PDF file to be split, or the PDF bytes.

  • Name
    splits
    Type
    Array of Integers
    Description

    The page numbers at which to split the PDF file.

Request

POST
/v1/pdf/split
curl -X POST https://data.fastpdfservice.com/v1/pdf/split \
  -H "Authorization: {token}" \
  -F "file=@path/to/your.pdf" \
  -F "splits=[3, 6]"

POST/v1/pdf/split-zip

Split PDF to many

This endpoint allows you to split a PDF file at the given pages, into multiple PDFS, and return a ZIP file containing the resulting PDF files.

Required attributes

  • Name
    file
    Type
    File
    Description

    The path to the PDF file to be split, or the PDF bytes.

  • Name
    splits
    Type
    Array of Array of Integers
    Description

    The page ranges at which to split the PDF file.

Request

POST
/v1/pdf/split-zip
curl -X POST https://data.fastpdfservice.com/v1/pdf/split-zip \
  -H "Authorization: {token}" \
  -F "file=@path/to/your.pdf" \
  -F "splits=[[1, 3], [4, 6]]"

POST/v1/pdf/compress

Compress PDF

This endpoint allows you to compress a PDF file. It optimizes the PDF internal, by creating a cross-reference table to avoid including the same images multiple times within the PDF.

In certain cases, this can reduce substantially the PDF size.

Required attributes

  • Name
    file
    Type
    File
    Description

    The path to your PDF file to be compressed, or the PDF bytes.

Optional attributes

  • Name
    options
    Type
    object
    Description

    Optional compression options.

Request

POST
/v1/pdf/compress
curl -X POST https://data.fastpdfservice.com/v1/pdf/compress \
  -H "Authorization: {token}" \
  -F "file=@path/to/your.pdf" 

POST/v1/pdf/metadata

Edit PDF Metadata

This endpoint allows you to edit the metadata of a PDF file.

Required attributes

  • Name
    file
    Type
    File
    Description

    The paths to the PDF file whose metadata is to be edited, or the PDF bytes.

  • Name
    metadata
    Type
    object
    Description

    The new metadata to be set in the PDF file.

    Available metadata fields: /Title, /Author, /Subject, /Producer, /Creator.

Request

POST
/v1/pdf/metadata
curl -X POST https://data.fastpdfservice.com/v1/pdf/metadata \
  -H "Authorization: {token}" \
  -F "file=@path/to/your.pdf" \
  -F "metadata={'/Title': 'New Title', '/Author': 'New Author'}"

POST/v1/pdf/encrypt

Encrypt PDF

This endpoint allows you to encrypt a PDF file by adding a password protection to it. The password encrypts the content of the PDF, making it accessible only with the correct password.

Required attributes

  • Name
    file
    Type
    File
    Description

    The path to your PDF file to be encrypted, or the PDF bytes.

  • Name
    password
    Type
    string
    Description

    The password to encrypt the PDF.

Request

POST
/v1/pdf/encrypt
curl -X POST https://data.fastpdfservice.com/v1/pdf/encrypt \
  -H "Authorization: {token}" \
  -F "file=@path/to/your.pdf" \
  -F "password=YourPassword"