GuidePDF Operations

Split

This documentation provides an example of how to use the FileforgeClient to split a PDF into 2 PDFs.

Prerequisites

Ensure you have the following:

  • An API key for Fileforge as an environment variable: process.env.FILEFORGE_API_KEY
  • Node.js and npm installed.
  • The Fileforge Client installed.

Guide

Make sure to set a timeout for the request

If you are splitting a very large file, you may need to increase the timeout as shown below with the timeoutInSeconds parameter.

Split the PDF

1import { FileforgeClient } from "@fileforge/client";
2import * as fs from "fs";
3
4BETA TESTING - NOT YET AVAILABLE
5contact@fileforge.com for more information

About the options and output

You can pass the following parameters to the split method:

  • splitIndex: The index at which to split the PDF. The index is one-based, so the first page is 1.

The split method returns a .zip file containing the split PDFs. The .zip file contains the split PDFs as individual PDF files. It limits the size of the response.