Skip to content

Latest commit

 

History

History

pdf-text-decoding

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

Double-quote decoding in Docling PDFs

The embedded-TrueType/MacRoman quote-decoding problem in Docling #4493 is fixed in the official docling-parse 7.26.0 release. Upgrade the parser before considering the alternate backend or historical preview below.

Released repair confirmed on November 16, 2026

The official 7.26.0 release, published November 13, includes the merged repair #370 and the additional MacRoman repair #453. A November 14 comparison reported correct sample text through the default threaded backend with Docling 2.150.1 on Windows/Python 3.12, after changing only docling-parse to 7.26.0. The original reporter then confirmed and closed the issue on November 16.

python -m pip install --upgrade 'docling-parse==7.26.0'
python -m pip check

The comparison reports that Docling 2.150.1 permits this version through its existing >=7.22.2,<8.0.0 requirement. Check the requirements of your own Docling installation before upgrading, and keep your existing threaded backend and pipeline settings. This update reports the official release and public confirmation; no new local full-pipeline conversion or form-fill check was performed.

The public sample has no form fields. The reporter previously explained their threaded-backend and fillable-PDF requirements; their short confirmation does not provide separate form-processing test details.

The October checks below are historical comparisons, not the current release recommendation.

Stable release checked on 13 October 2026

The official PyPI docling-parse 7.22.3 release still produces three Ò and three Ó characters on the same public sample. All four sequential/threaded parsing checks, with sanitization on and off, completed with the same 148 character cells, 19 word cells and 3 line cells as the earlier released baseline. Their text remained incorrect; every cell rectangle matched the baseline and the previously checked preview.

The actual ThreadedDoclingParseDocumentBackend also retained the incorrect text with its default options, using docling-slim 2.138.0 and docling-core 2.101.1 on Python 3.12/macOS arm64. This was a scripted parser/backend check, without a new full-pipeline conversion, form-fill operation or reporter validation. At the time of that October check, PR #370 was open and unmerged; upgrading to 7.22.3 alone did not provide its decoding repair.

Native-parser preview checked on 12 October 2026

docling-parse #370, at commit f721ba4f75a5678b13178df90e4f6f9524772a37, fixed the quoted text in the updated sample during scripted checks:

Check Released parser 7.22.1 / 7.22.2 PR #370 preview
Sequential and threaded parsing, with sanitization on and off Three Ò and three Ó characters All six quotes decoded as straight double quotes
Materialized character, word and line cells 148 characters, 19 words, 3 lines Same counts; complete text correct at all three levels
Cell coordinates Baseline Every character, word and line rectangle unchanged from released 7.22.1

The preview also passed a check through Docling's actual InputDocument and ThreadedDoclingParseDocumentBackend: all three text lines, 19 word cells, text queries by rectangle and a 612 × 792 page image were available with default backend options. That check used docling-slim 2.138.0 and docling-core 2.101.1 on Python 3.12/macOS arm64. It did not run the full conversion pipeline or a form-fill operation. There was no confirmation from the reporter’s application at the time of that check.

The tested wheel came from the official CI run, artifact python-package-distributions-py3.12-macosx_arm64. Its archive SHA-256 was 7e712d5967c2631026de40242b3de2b414c6d8ee51b9678e74f1f57f3d1dc517. The contained wheel still reports version 7.22.1, but it is the PR build; installing the PyPI release with that version does not provide this repair.

At the time of this preview check, the PR was unmerged and the overall CI run included failed checks and wheel jobs. The official 7.26.0 release now supersedes this preview; do not install the historical artifact for this repair.

Historical alternate backend for applications that can switch

Keep your existing PdfPipelineOptions object, including its OCR, table and image settings. Set backend on PdfFormatOption before constructing the converter:

from pathlib import Path

from docling.backend.pypdfium2_backend import PyPdfiumDocumentBackend
from docling.datamodel.base_models import InputFormat
from docling.document_converter import DocumentConverter, PdfFormatOption

# pipeline_options is the PdfPipelineOptions object from your current conversion.
converter = DocumentConverter(
    format_options={
        InputFormat.PDF: PdfFormatOption(
            pipeline_options=pipeline_options,
            backend=PyPdfiumDocumentBackend,
        ),
    },
)
result = converter.convert(Path("input.pdf"))
result.document.save_as_markdown(Path("output.md"))
result.document.save_as_json(Path("output.json"))

For an otherwise default conversion, omit pipeline_options=pipeline_options. The regular docling installation includes PDFium; a minimal installation needs the docling-slim[format-pdf-pypdfium2] extra in addition to the dependencies for its existing pipeline.

Parser-specific ThreadedDoclingParseBackendOptions do not transfer to this backend. If your input needs a password, retain it through the documented PdfBackendOptions(password=...) option. Keep the original PDF and compare the complete output before applying this to a document collection.

Earlier full-pipeline comparison

On 3 October 2026, both backends completed the same one-page updated sample through Docling's standard pipeline and produced Markdown and structured JSON.

Backend Result
Default threaded docling-parse All three quoted phrases contained Ò and Ó.
PDFium All three text lines and all six double quotes were correct.

PDFium's text extraction method was observed running. Its raw text contained curly quotes; Docling's page assembler then applied its normal conversion to straight double quotes. The final Markdown contained:

This Sample Document "Sample Agreement" dated 01/01/2025 "Effective Date".
All terms defined as "Deliverables" apply herein.

The checks used Docling 2.132.0 (docling-slim), docling-parse 7.22.1, docling-core 2.99.0 and pypdfium2 5.13.0 on Python 3.12/macOS arm64. CPU processing, OCR and table processing remained enabled, using RapidOCR 3.9.2 with ONNX Runtime 1.30.0. The sample contains native text and no tables; this does not establish OCR or table accuracy for other PDFs. These were scripted conversions, with no adoption confirmation from the original reporter.

This is a configuration workaround for that sample. It changes the PDF backend for the whole conversion and has not been tested on the reporter's private document. Recheck later releases before retaining the workaround.

Optional coffee

If this saves you some time and you'd like to buy me a coffee, thank you. It's entirely optional; the guide is free.

  • USDC / SOL · Solana: 9tY6D9mwcFaJwwzEHvw2v7nhSpdjqjNBYtuooyBN6rYy
  • USDC / ETH · Base: 0x568Ab98578d682FB0B0b45619BE73EbFfbf5a6eA
  • USDT · BNB Smart Chain (BEP20): 0x568Ab98578d682FB0B0b45619BE73EbFfbf5a6eA