PDF parsing

Updated at:

The PDF parsing operator extracts content, like text and images, from PDF files in an input dataset. This topic describes how to configure this operator.

Prerequisites

  • To use the workflow feature, you must purchase the unstructured data feature for your instance.

  • You have created a workflow. For more information, see Create and manage a workflow.

Permissions

Project administrators, developers, analysts, and custom project roles with the Dataset-Use permission in a Basic project can use any dataset in the project as the operator's input and output.

Supported file formats

The PDF parsing operator supports PDF files.

Procedure

  1. In the top navigation bar of the Dataphin home page, choose Develop > Data Development.

  2. On the Develop page, choose Projects from the top menu bar.

  3. In the left-side navigation pane, choose Data Processing > Workflow. In the Workflow list, click the desired workflow to open its canvas. From the Operator Library on the left, drag the PDF parsing operator to the canvas. In the PDF parsing panel on the right, configure the following parameters.

    Parameter

    Description

    Step name

    Enter a name for the operator. The name can contain any character and must not exceed 256 characters.

    Input configuration

    Dataset

    Select the dataset to process. You can choose a Hybrid dataset or a Table dataset. After you select a dataset, you must also select its Version. By default, the first version in ascending order is selected.

    If this operator is downstream from another, its input dataset is typically the output from the upstream operator.

    Input field

    Select a field from the input dataset that contains the storage path of the PDF files. You can only select fields where the Is URL parameter is set to Yes.

    Filter condition (Optional)

    Enter a SQL WHERE clause to filter the data. You can use system-level global variables, such as the business date variable ${bizdate}.

    Operator configuration

    Model-assisted correction

    When enabled, an LLM automatically corrects results from the built-in model if it performs poorly (e.g., due to layout misplacement), improving parsing accuracy.

    Image content understanding

    When enabled, an LLM analyzes the image content in the PDF and replaces the images with text descriptions in the output Markdown file. You must also enter an Image understanding prompt of up to 2,000 characters.

    Model

    This parameter is available only when Model-assisted correction or Image content understanding is enabled. Both features share the same model. You can select only a model that is Enabled on the Intelligent application management > Model configuration page and is of type Text or Vision (images and videos).

    Note

    Output configuration

    Dataset

    You can select Source dataset or Other datasets. If the source dataset is a Table dataset, the system selects Other datasets by default.

    If you select Other datasets, you must specify a Hybrid dataset and its Version as the output dataset. By default, the first version in ascending order is selected. You can also select a different version of the source dataset.

    If you select Source dataset, the operator writes the generated metadata to the metadata table of the source dataset's selected version.

    Include image links in output Markdown text

    If you select Yes, links to the parsed images replace the images in the output. If you select No, these links are omitted.

    File output path

    Enter the name of the output directory. If the directory does not exist, the system creates it.

    • The parsed text file is named using the format ${PDF_file_name+an_auto-incrementing_number_starting_at_1}.md.

    • The system generates a folder to store all parsed images.

    Load policy

    If the metadata table of the selected output dataset contains a primary key, Update on primary key conflict is selected by default. Otherwise, Append data is selected by default.

    • Append data: Appends new data to the target table. An error is reported if a primary key or constraint conflict occurs.

    • Update on primary key conflict: If a primary key or constraint conflict occurs, the system deletes the conflicting row before inserting the new data.

    • Overwrite: Deletes all data from the target table before writing the new data.

    Note

    When you select Source dataset as the output dataset, only the Update on primary key conflict load policy is available.

    Field mapping

    The PDF parsing operator outputs the following fields:

    • markdown_url: The storage path of the Markdown text.

    • markdown_content: The content of the Markdown file. This is an optional field. Avoid mapping this field if the content is long.

    • image_folder_url: The storage path of the image folder.

    By default, the operator maps its output fields to fields with matching names in the output dataset. You can also manually select target fields for custom mapping. In addition, you can map pass-through fields from the source dataset to the target dataset. You can manage field mappings in the following ways:

    • Add output field: Adds a new, empty row for field mapping. This feature is available only when you select Other datasets as the output dataset.

    • Batch mapping: Allows you to perform batch manual mapping, same-name mapping, or same-row mapping. This feature is available only when you select Other datasets as the output dataset.

    • Delete mapping: You cannot delete mappings for the operator's fixed output fields. Click the Delete icon to remove a field mapping row.

  4. After you configure the operator, click Save in the top menu bar of the canvas.

    After you configure an operator, you can continue to build your workflow by adding upstream or downstream operators.