Skip to content

Tagged text extraction removes a word boundary within one marked-content section #243

Description

@lin-string

Summary

Page.extract_text_tagged() concatenates consecutive text objects within the same marked-content section without preserving a word boundary when the next object continues on a new visual line.

Versions tested

Test files

Reproduction

import playa

with playa.open("UA1_Tpdf-G3_02.pdf") as document:
    print(document.pages[0].extract_text_tagged())

Actual behavior

The sentence contains The blue backgroundis decorative: the end of one text object and the beginning of the next are joined without whitespace.

Expected behavior

The line transition should preserve the word boundary and return The blue background is decorative.

Relevant implementation

Page.extract_text_tagged() groups text objects by marked-content section and uses chars = "".join(c) inside each group. Its line-transition check only runs between different MCIDs, so it cannot insert a separator between text objects within the same marked-content section.

Disclosure

This issue was prepared by an AI coding agent on behalf of @lin-string. The reproduction and results were verified against the current default branch.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions