Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Correctly Extract Chinese Characters from PDF Documents #154

Open
xujryan opened this issue May 31, 2024 · 4 comments
Open

Unable to Correctly Extract Chinese Characters from PDF Documents #154

xujryan opened this issue May 31, 2024 · 4 comments

Comments

@xujryan
Copy link

xujryan commented May 31, 2024

Description

When using Marker to extract Chinese characters from some PDF documents, some characters are not extracted at all, while others are extracted as garbled text. Below are three example files, including the original PDF files and the parsed Markdown files.

Example

Do you have any suggestions or recommendations for handling or parsing these types of Chinese documents?

@lqhl
Copy link

lqhl commented May 31, 2024

I think #153 is related.

@VikParuchuri
Copy link
Owner

Do these PDFs have garbled text in them? Does setting OCR_ALL_PAGES to force OCR change anything?

@VikParuchuri
Copy link
Owner

I get better results by settings OCR_ALL_PAGES=true, which forces OCR. I think this PDF has bad/garbled text in it (at least the first one, which is the one I tested).

@elgarteo
Copy link

I ran into the same issue while extracting Chinese text from a PDF document edited by macOS’ built-in PDF reader Preview, which turns out to be the culprit. Garbled text only appears when extracting from the edited PDF, not the original file.

I did some tracing and the garbled text are produced by the upstream package Pdfium, specifically the FPDFText_GetUnicode method. Someone actually raised this issue as early as 2017 but nothing has been done.

The solution for now is to avoid passing in PDF files edited with Preview (and potentially other PDF editors).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants