PDFDocument write(to:) removes all InkList data in PDFAnnotation

I am using PDFKit in iOS 11 via Xcode 9.


When I open a PDF file contains ink annotations, PDFDocument(url:) perfectly opens it and shows everything great.


After I changed something and saved it using write(to:), all InkList array data lost and changed to empty arrays in the saved PDF file.


i.e., PDFDocument write(to:) method removes PDFAnnotation InkList array data.


I reported it as a bug some days ago but no reply yet.


Is there anything that I can do not losing InkList data using write(to:) method?

Replies

Although I do not have a solution to contribute, I would like to add to the discussion, and add a link I've found that contain the similar issue. (incase the link receives a solution)


StackOverflow:

"PDFAnnotationSubType Ink not saved when persisting (iOS11, PDFKit)"

https://stackoverflow.com/questions/48530408/pdfannotationsubtype-ink-not-saved-when-persisting-ios11-pdfkit/48589894#48589894


PS. If a solution has been found, please do share

I am also facing the same problem. Please update If anyone has the solution

I have a similar problem. With any method of storing PDF to file (such as PDFDocument or NSData) the same result is everywhere - invalidly saved inkList array (or PDFAnnotation.paths, which are the same).



Want to note that PDF viewers such as Adobe Acrobat Reader, Apple iBooks or PDFView from PDFKit correctly render these ink annotations. This means that the points of the bezier curves persist, but when loading such documents, they do not "jump" to the high level class (PDFAnnotation.paths). They stay at a lower level, in the internal implementation of PDFKit.



It's interesting that if you create ink annotation for the first time with Adobe Acrobat Reader and load this document, inkList array is filled correctly. But adding one more ink annotation programmatically, breaks all the previous inkList arrays in PDF after reload.



This is definitely bug in PDFKit. Solution by the link above works, but it's a kludge.