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.
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
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"
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
curl -X POST https://data.fastpdfservice.com/v1/pdf/split \
-H "Authorization: {token}" \
-F "file=@path/to/your.pdf" \
-F "splits=[3, 6]"
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
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]]"
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.
If your PDF was generated using FastPDF, you do not need to use this method, your document is already compressed.
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
curl -X POST https://data.fastpdfservice.com/v1/pdf/compress \
-H "Authorization: {token}" \
-F "file=@path/to/your.pdf"
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
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'}"
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.
Use a strong password for better security. The encrypted PDF will require this password for viewing and editing.
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
curl -X POST https://data.fastpdfservice.com/v1/pdf/encrypt \
-H "Authorization: {token}" \
-F "file=@path/to/your.pdf" \
-F "password=YourPassword"