Combine Workflows

One of the advantages of PSPDFKit API is that it allows you to combine actions and parts in any order you like. This enables you to represent many complex workflows with a single request to the API. Here we’ll show you some of these use cases, which you can use as a jumping off point for your own workflows.

Merge and OCR

Let’s say you scanned in a document and now have a set of images you want to merge into a single PDF and then perform OCR on to make the text searchable. Using PSPDFKit API, you can do this with a single request:

JSON
{
  "parts": [
    {"file": "page-01"},
    {"file": "page-02"},
    {"file": "page-03"},
    {"file": "page-04"},
    {"file": "page-05"},
    {"file": "page-06"},
    ...
  ],
  "actions": [
    {
      "type": "ocr",
      "language": "english"
    }
  ]
}

The way this works is that PSPDFKit API will first create a PDF from all the pages you supplied. Then, running OCR on this PDF will make the text selectable and searchable. Finally, the resulting PDF is sent back to you.

HTML and PDF

PSPDFKit API allows you to combine both HTML and PDF parts as you please. You can use this, for example, to add a PDF cover page to a report generated from HTML:

JSON
{
  "parts": [{ "file": "cover.pdf" }, { "html": "report.html" }]
}

The way this works is that PSPDFKit API will generate a PDF from the HTML report and then add the cover page you supplied in front of it.