1

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;
AAN
  • 31
  • 6

1 Answers1

1

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.

AAN
  • 31
  • 6
  • Try to reload your pdf document from the path you write to NSURL *newURL = [NSURL fileURLWithPath:newPath]; pdfdocument = [[PDFDocument alloc] initWithURL:newURL]; – AAN Dec 18 '19 at 13:32