Docling2Parquet Transform

October 24, 2025 ยท View on GitHub

The Docling2Parquet transform iterates through PDF, Docx, Pptx, Images files or zip of files and generates parquet files containing the converted document in Markdown or JSON format.

The conversion is using the Docling package.

Please see the set of transform project conventions for details on general project conventions, transform configuration, testing and IDE set up.

Contributors

Input files

This transform supports the following input formats:

  • PDF documents
  • DOCX documents
  • PPTX presentations
  • XLSX spreadsheets
  • Image files (png, jpeg, etc)
  • HTML pages
  • Markdown documents
  • ASCII Docs documents
  • XML in JATS format (e.g. scientific publications)
  • XML of USPTO publications

The input documents can be provided in a folder structure, or as a zip archive. Please see the configuration section for specifying the input files.

Output format

The output table will contain following columns*

output column namedata typedescription
source_filenamestringthe basename of the source archive or file
filenamestringthe basename of the document file
contentsstringthe content of the document
document_idstringthe document id, a random uuid4
document_hashstringthe document hash of the input content
extstringthe detected file extension
hashstringthe hash of the contents column
sizestringthe size of contents
date_acquireddatethe date when the transform was executing
num_pagesnumbernumber of pages in the document
num_tablesnumbernumber of tables in the document
num_doc_elementsnumbernumber of document elements in the document
document_convert_timefloattime taken to convert the document in seconds
*image_binslistlist of image binaries extracted from pictures and/or pages
*orig_image_fpathslistlist containing original images paths from extracted pictures and/or pages
*num_picturesnumbernumber of pictures extracted from document

* columns only added with specific configuration parameters set for generating picture/page images

Configuration

The transform can be initialized with the following parameters.

ParameterDefaultDescription
data_files_to_use-The files extensions to be considered when running the transform. Example value ['.pdf','.docx','.pptx','.zip']. For all the supported input formats, see the section above.
batch_size-1Number of documents to be saved in the same result table. A value of -1 will generate one result file for each input file.
artifacts_pathPath where to Docling models artifacts are located, if unset they will be downloaded and fetched from the HF_HUB_CACHE folder.
contents_typetext/markdownThe output type for the contents column. Valid types are text/markdown, text/plain and application/json.
do_table_structureTrueIf true, detected tables will be processed with the table structure model.
do_ocrTrueIf true, optical character recognition (OCR) will be used to read the content of bitmap parts of the document.
ocr_engineeasyocrThe OCR engine to use. Valid values are easyocr, tesseract, tesseract_cli.
bitmap_area_threshold0.05Threshold for running OCR on bitmap figures embedded in document. The threshold is computed as the fraction of the area covered by the bitmap, compared to the whole page area.
pdf_backenddlparse_v2The PDF backend to use. Valid values are dlparse_v2, dlparse_v1, pypdfium2.
double_precision8If set, all floating points (e.g. bounding boxes) are rounded to this precision. For tests it is advised to use 0.
pipelinemulti_stageThe pipeline to use - multi_stage or vlm (granite-docling)
generate_picture_imagesFalseIf true, generates image binaries for pictures extracted from the document.
generate_page_imagesFalseIf true, generates image binaries for each page of the document.
images_scale2.0sets the image resolution scale

Example

{
    "data_files_to_use": ast.literal_eval("['.pdf','.docx','.pptx','.zip']"),
    "contents_type": "application/json",
    "do_ocr": True,
}

Usage

Launched Command Line Options

When invoking the CLI, the parameters must be set as --docling2parquet_<name>, e.g., --docling2parquet_do_ocr=true.

Running the samples

To run the samples, use the following make target

  • run-cli-sample - runs dpk_docling2parquet/transform_python.py using command line args

These targets will activate the virtual environment and set up any configuration needed. Use the -n option of make to see the detail of what is done to run the sample.

For example,

make run-cli-sample
...

Then

ls output

To see results of the transform.

Code example

See the sample notebook for an example

Transforming data using the transform image

To use the transform image to transform your data, please refer to the running images quickstart, substituting the name of this transform image and runtime as appropriate.

Testing

Following the testing strategy of data-processing-lib

Currently we have:

Docling2Parquet Ray Transform

This module implements the ray version of the docling2parquet transform.

Configuration and command line Options

Ingest Docling to Parquet configuration and command line options are the same as for the base python transform.

Running

Launched Command Line Options

When running the transform with the Ray launcher (i.e., TransformLauncher), in addition to those available to the transform for the Python version in this file, the set of launcher options are available.

Code example (Ray)

See the sample notebook for an example

Transforming data using the transform image

To use the transform image to transform your data, please refer to the running images quickstart, substituting the name of this transform image and runtime as appropriate.

Prometheus metrics

The transform will produce the following statsd metrics:

metric nameDescription
worker_doc_countNumber of documents converted by the worker
worker_doc_pages_countNumber of document pages converted by the worker
worker_doc_page_avg_convert_timeAverage time for converting a single document page on each worker
worker_document_convert_timeTime spent converting a single document

Credits

The Docling document conversion is developed by the AI for Knowledge group in IBM Research Zurich. The main package is Docling.