Post

Replies

Boosts

Views

Activity

When saving PDFDocument some important information about the content might be lost.
After saving document via PDFKit (using PDFDocument function "write(to: )" ) some important information might be lost. For example, original document generated via Google Drive: "doc_original.pdf" https://www.dropbox.com/s/y0kfdlp2eo9zohs/doc_original.pdf?dl=0 Document after saving via PDFKit: "doc_saved_pdfkit.pdf" https://www.dropbox.com/s/fpegfcifb6yd1oc/doc_saved_pdfkit.pdf?dl=0 If you open files via any PDF viewer (ex. Preview), both looks the same. But if you try to search through doc_saved_pdfkit.pdf, the search won't work (in the original document it works) I've investigated this issue and found that when document saved via PDFDocument function "write(to: )" (even without any modifications) font parameter /ToUnicode being modified and information how to convert glyph codes to unicode is lost (see attached decoded stream contents). That's why it's impossible to find text or copy text from that doc. /ToUnicode stream content for "doc_original.pdf" /ToUnicode content for "doc_saved_pdfkit.pdf" The issue reproduces with Verdana and Roboto font families on iPhone on iOS15.1 and iOS15. Also I've checked on the simulator, it reproduces in iOS 13.5 as well
1
0
590
Dec ’21