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

Error on Chinese Characters text fetching!!! any idea to resolve it? #28

Open
marcusau opened this issue Mar 22, 2021 · 1 comment
Open

Comments

@marcusau
Copy link

Hi , I am using the module to fetch texts (combination of both English and Chinese) from the pdf files, with the following error:

from pyxpdf import Document, Page, Config
from pyxpdf.xpdf import TextOutput, TextControl, page_iterator
with open(pdf_file, 'rb') as fp:
    doc = Document(fp)
for page in doc:
    res_box =page.find_text('Cornerstone', search_box=[0, 0, 400, 400], case_sensitive=True)
    if res_box:
        print(page.label,res_box)

results:

Syntax Error: Unknown character collection 'Adobe-CNS1'
278 (406.8096, 94.85200000000002, 465.46160000000003, 104.47700000000002)
Syntax Error: Unknown character collection 'Adobe-CNS1'
279 (69.6101, 103.50040000000014, 106.93410000000002, 109.62540000000014)
280 (230.7095, 348.65500000000003, 284.4775, 358.28000000000003)
Syntax Error: Unknown character collection 'Adobe-CNS1'
Syntax Error: Unknown character collection 'Adobe-CNS1'
Syntax Error: Unknown character collection 'Adobe-CNS1'
@mlove4u
Copy link

mlove4u commented Oct 1, 2021

@marcusau
try to instal this package:

pip install pyxpdf_data

The CJK encoding files is needed.
See: https://www.xpdfreader.com/download.html

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

2 participants