-
Notifications
You must be signed in to change notification settings - Fork 1
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
Cannot load PDF file that contains non-ascii characters in file path on Windows #8
Comments
I can't authoritatively say this is not an issue with this pypdfium, since the library bindings are outside of my normal wheelhouse, but since it looks like that is a direct interface to the The related source that will show pypdfium is just forwarding the info to the linked library rather than doing its own transformations: Line 1170 in 5807c8a
I have run into issues with libraries not supporting filenames before, and the best option I have come up with before is just to rename and open and then rename the output or possibly use API Docs for |
This comment has been minimized.
This comment has been minimized.
Confirmed this is a platform-specific issue, see https://github.com/mara004/pypdfium-reboot/issues/1#issuecomment-950174027 |
Thank you, using FPDF_LoadMemDocument I can now load any pdf file without error. And here is my code for someone who need it. def _load_pdf(pdf_filepath, password=None):
# return None if file not found
# return pdfium.FPDF_LoadDocument(f'{pdf_filepath}', password)
try:
with open(f'{pdf_filepath}', 'rb') as pdf_file:
pdf_content_buff = pdf_file.read()
buff_size = len(pdf_content_buff)
return pdfium.FPDF_LoadMemDocument(pdf_content_buff, buff_size, password)
except FileNotFoundError:
return None |
This is now fixed upstream. pypdfium obviously doesn't get updates anymore, but pypdfium2 wheels contain the fix since quite some time. pypdfium2 now also properly offers other loading strategies in the support mode, including Important note: the |
OS: Windows 10 x64 21H1 (build 19043.1288)
Python: CPython 3.6.8 x64
Library version: pypdfium==0.0.15
Input pdf file path that contains non-ascii character (eg. tênfilechứakýtựđặcbiệt.pdf) cannot be read by the library.
The text was updated successfully, but these errors were encountered: