Skip to main content
Split PDF Writer Step

The Split PDF Writer step is used to split a PDF document into separate PDF files based on the number of pages in the original file.

Praise Magidi avatar
Written by Praise Magidi
Updated over 4 months ago

Illustrated in the below image is a flow where a Record Generator Source Step is used to present the PDF array fields. The Split PDF Writer step is used to split the PDF file. The Calculator step after the Split PDF writer step is used to capture the output as an array of base64 strings correlating to the pages in the PDF.

The Split step is used to split the output which is an array. The Calculator step after the Split mapper step is used to convert the record to a buffer. An SFTP Server destination step is used to save the PDF files that were created from the one PDF file which was split.

The image below is an example of a PDF document that will be split into 2 PDF files since it contains 2 pages.

Adding a Split PDF Writer Step

To add a Split PDF Writer step in a flow, follow the below instructions:

1. Click on the highlighted icon as shown in the below image.

2. The below page will appear. Select or search for a Writer step to pull out the source data. Click on the Writer tab and select Split PDF as shown in the image below.

Configuring a Split PDF Writer Step

Illustrated in the below image is the configuration that is available in the Split PDF Writer step.

From Field section – Retrieves the value from a field on the record.

Is Base64 checkbox – The retrieved value from a field on the record is Base64 encoded.

Using a Split PDF Writer Step

  1. The image below shows data in the Record Generator step. The PDF documents are referenced as Base64 strings.

2. The Split PDF writer step is added to the flow.

3. The Calculator step is added after the Split PDF writer step to capture the output as an array of base64 strings correlating to the pages in the PDF. The page below illustrates the code that is used.

The output after the Calculator step is shown in the image below.

4. The Split step is added after the Calculator step to split the output which is an array which is shown in the below image.

Illustrated on the page below is the output after the Split step.

5. The Calculator step is added after the Split mapper step to convert the record to a buffer. The JSON code is illustrated in the below image. Line 13 generates a unique ID as the file name and adds the PDF file extension.

The output after the Calculator step is shown in the image below.

Viewing the created PDF file

1. Click the Execute Flow button shown in the image below:

2. Click the Create Run button.

3. The PDF document will be saved on the SFTP Server Destination step where it can be downloaded after the run has finished processing. The SFTP Server Destination Step configuration is illustrated in the image below. The Path field contains the path with the path extension {@record.path} that was created in the previous Calculator step.

The images below are the 2 PDF files that were created and sent to the SFTP Server.

Did this answer your question?