Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device.
Atlassian cookies and tracking notice, (opens new window)
Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Confluence

Aspire 5
Results will update as you type.
  • What is Aspire?
  • Getting Started
  • Generative AI
  • Crawling Features
  • Rest API Usage
  • Configuration
  • How-to articles
  • Connectors
  • Publishers
  • Workflows
    • Admin UI - Workflows
    • Rest API - Workflows
    • Applications
    • Summarization
    • Canonical Workflows
      • Embeddings Canonical Workflow
      • MS Office Processing Canonical Workflow
      • Multimedia Processing Canonical Workflow
      • PDF Processing Canonical Workflow
      • SAGA Parser Tag Extraction Canonical Workflow
  • Aspire Tools
    Calendars

You‘re viewing this with anonymous access, so some content might be blocked.
/
PDF Processing Canonical Workflow
Updated Apr 24

    PDF Processing Canonical Workflow

      • 1 Introduction
      • 2 Workflow configuration
        • 2.1 Configuration Variables
      • 3 Expected Input
        • 3.1 Job input
        • 3.2 Document Input
      • 4 Workflow output
        • 4.1 Job Output
        • 4.2 Document Output
      • 5 Limitations
        • 5.1 TOC Chunking
        • 5.2 Paragraph Chunking
        • 5.3 Table extraction with Tabula
      • 6 Errors and Troubleshooting
        • 6.1 Corrupt PDF Files
        • 6.2 Tabula generates many empty columns/rows
        • 6.3 Tabula: “java.lang.IllegalArgumentException: lines must be orthogonal, vertical, and horizontal”
        • 6.4 General
      • 7 Done!

      Introduction

      The PDF Processing Canonical Workflow processes a PDF file and can perform 3 different tasks:

      • Text Chunking: extracts text from the PDF file pages. It can be configured to extract text chunks based on the file’s TOC (table of contents) or to treat paragraphs in the document as chunks.

      • Image Extraction: extracts a list of images per page with their corresponding name, size, and content.

      • Table Extraction: extracts HTML representations of tables in the PDF file. The extraction can be performed with the Tabula library or by using the AWS Textract service.

      The PDF Processing Canonical Workflow has 2 main stages: one stage for the workflow configuration and one stage for the actual processing of the PDF files. It also has an optional stage for table extraction with AWS Textract that will or will not be executed depending on the configuration.

      For the instructions below, please request and reference the following files:

      • workflow_pdf processing canonical workflow_export.aspire

      • pom.xml

       

      Workflow configuration

      Each Canonical Workflow has a configuration script where initialization variables can be set or changed according to the needs of the client. This script is always at the very beginning of the workflow stages.

      Also, all necessary external jars are preloaded in the file “pdf-processing-workflow-[VERSION].jar,” which needs to be loaded in the “External Resources” sections of the processing stages.

       

       

       

       

       

      Additionally, if AWS Textract is enabled, the AWS Textract component needs to be configured with the client AWS account and the document field that will contain the path to the S3 bucket where PDFs will be available or uploaded.

       

       

       

       

       

       

       

       

       

      Configuration Variables

      useChunking

      This variable has to be set to true if PDF files’ text chunk extraction is required. Otherwise, set this variable to false.

      tocChunking

      Chunk extraction can be performed by TOC (table of contents) area or by paragraph. Set this variable to true if TOC extraction is required; otherwise, set it to false.

      chunksFieldName

      This variable controls the name of the field where the text chunks list is stored.

      useImageExtraction

      This variable has to be set to true if PDF files’ image extraction is required. Otherwise, set this variable to false.

      imagesFieldName

      This variable controls the name of the field where the images list is stored.

      createImageSubjobs

      This variable has to be set to true if you need to generate subjobs for images extracted from the PDF files. Otherwise, set this variable to false.

      useTableExtraction

      This variable has to be set to true if PDF file table extraction is required. Otherwise, set this variable to false.

      useTextract

      Basic table extraction can be performed using the Tabula library. A more advanced and accurate extraction can be performed by using the AWS Textract service. Set this variable to true if AWS Textract is required; otherwise, set it to false.

      tablesFieldName

      This variable controls the name of the field where the tables list is stored.

      Expected Input

      Job input

      Job variable name

      Job variable description

      contentStream

      This variable holds the content of the file being processed. Normally it is not accessed directly but through framework functions such as “getContentStream“. Aspire connector’s text extraction consumes this stream, so be sure to turn off text extraction in the connector that uses the workflow.

      Document Input

      Document variable name

      Document variable description

      title

      This variable is used to infer the name of the file and its extension. Used by all chunk, image, and table extraction.

      action

      This variable is only used during subjobs creation.

      id

      This variable is only used during subjobs creation.

      Workflow output

      Job Output

      Job variable name

      Job variable description

      No job output variables.

      Document Output

      Document variable name

      Document variable description

      [user_defined_field for text chunks]

      A list of chunk objects. Each chunk object contains a section name, a list of paragraphs in the chunk, a chunk number, and a total number of words in the chunk (from all paragraphs in it). The name of the field is defined by the user in the workflow configuration.

      [user_defined_field for pdf images]

      A list of image objects. Each image object contains a page index, the name of the image, the size of the image, and the content of the image. The name of the field is defined by the user in the workflow configuration.

      [user_defined_field for pdf tables]

      A list of HTML table representations of tables in the PDF. The name of the field is defined by the user in the workflow configuration.

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      image-20260412-002015.png

       

       

       

       

       

       

       

      image-20260412-002119.png
      image-20260412-002141.png
      image-20260412-002349.png
      image-20260412-002419.png

       

      If Chunk Extraction is enabled, PDF chunks will be listed inside a “pdfChunks” node inside the document. Inside the node, chunks found in the document will be listed:

      image-20260412-003115.png

      If Image Extraction is enabled, a list of images will be generated inside a node called “pdfImages.” The node will contain image metadata as well as the image content from images in the PDF document:

      image-20260412-003207.png

      If Table Extraction is enabled and Tabula is used to extract tables, the HTML representations of those tables will be in a “tables_html” node. Inside that node, we will have all the tables present in the PDF document.

      image-20260412-003259.png

      Subjobs generated for images look like this:

      image-20260412-003343.png

      Limitations

      TOC Chunking

      Extracting chunks with the Table of Contents option requires a good layout of the links in the processed document to get good and semantically meaningful chunks. Documents with links to random paragraphs or to a page footer, for instance, instead of the actual start or title of a topic, may result in poor-quality chunks.

      Paragraph Chunking

      Paragraph chunking quality is highly dependent on the paragraph structure of the PDF, so while a well-structured document might result in semantically meaningful chunks, a badly structured document will more likely result in non-meaningful or badly split chunks.

      Table extraction with Tabula

      Tabula library extraction, while having a fair quality table detection for well-defined tables in the document, might fail to recognize some types of tables that a more robust option, like, for example, AWS Textract, would. It could also generate an error sometimes if lines in a table are not perfectly vertical or horizontal.

      Errors and Troubleshooting

      Corrupt PDF Files

      While no actual PDF files are used during the processing (an InputStream is generated from the content stream in the pipeline instead), previous manipulation of the content stream of the document might corrupt it and generate IOExceptions as a result. Pinpointing the part of the process that manipulates the content stream and fixing it is a way to solve the problem. A way to work around it would be to exclude the document altogether from the crawl.

      Tabula generates many empty columns/rows

      When extracting table data, you may notice the Tabula component might generate an exaggerated number of empty rows or columns. This is a known issue. Also, this won’t affect the display of tables in most browsers since these are ignored.

      Tabula: “java.lang.IllegalArgumentException: lines must be orthogonal, vertical, and horizontal”

      Tabula might throw this exception if it detects a table that has lines that are not perfectly horizontal or vertical.

      General

      Generally, the images and table lists generated by the corresponding extraction might come empty if the document does not contain images or tables or if the libraries fail to detect these objects. In the case of table extraction. Switching table extraction methods can help alleviate the issue.

      Done!

      Your workflow is now configured and ready to be used.

       

       

      Copyright © 2024 Accenture

      Contact Us: SCAAssetsSupport@accenture.com

      {"serverDuration": 30, "requestCorrelationId": "c426b87567134c99aa5ec132d4d1fb2a"}