Unable to save pdf form data using PDFKit iOS 11

318 views Asked by At

I have loaded a pdf form using PDFKit in iOS 11. I am trying to save the editable fields ( Checkbox, TextBox) values. How do I get back the editable PDFDocument object to save the PDF contents using

  • (BOOL)writeToFile:(NSString *)path;
1

There are 1 answers

1
AAN On

Thanks. I did something like this. I added and Observer and on receiving notification when the pdf changes write the contents to a filepath

PDFView *view = notification.object;
PDFDocument *myDocument = view.document;
NSData* content = myDocument.dataRepresentation; 
[content writeToFile:newPath atomically:YES];

That worked for me.