Can not render some text of pdf on iOS and Web
Hello, I used pdfrx: 1.0.101 (flutter 3.24.5) to render a pdf file below.
And I use PdfPage.render() to get the image of a pdf page.```
There are some Chinese characters in the attached PDF, which can be displayed on the Android platform, but cannot be displayed on the iOS and web platforms. I want to understand the reason, please help me take a look at this issue. In the webDemo of the project I tested, Chinese characters also cannot be displayed, but I am not sure whether the latest dependency has fixed this problem. Thank you
The reason is very easy. The PDF file uses two fonts (Helvetica and STSong-Light) which are not embedded in the file. With Adobe Acrobat on Windows, we can easily check the missing fonts:
By default, pdfium searchs these fonts on OS's font directories and if they exist, it is used to render the texts. But if not exist, the texts are not correctly rendered.
Pdfrx.fontPaths is a mechanism to specify font directories on your app. But even with the API, you should prepare the fonts on your app somehow.
Ah, currently, on Web platform, font-path is not supported anyway :( Because Web browser does not have proper mechanism to access OS's directories, we should have some other mechanism to specify these missing fonts...
Thank you very much for your reply, it is very clear. However, I would like to ask you about the parsing logic of PDF fonts. On iOS, flutter_pdf_render can render these Chinese characters, but pdfrx cannot. I observed that for English fonts, both flutter_pdf_render and pdfrx perform fallback font replacement, and only flutter_pdf_render does it for Chinese characters. Can we set a fallback font for pdfrx? Is there any direction to start with?
Ah, currently, on Web platform, font-path is not supported anyway :( Because Web browser does not have proper mechanism to access OS's directories, we should have some other mechanism to specify these missing fonts...
Is same as https://github.com/espresso3389/pdfrx/issues/140 ? Thanks for your reply, have a good day
Ah, this is actually a duplicate of #140.
So I want to close the issue and re-open #140. Anyway, I recently have a progress on the issue. See #140.