问题
I am creating an app where I open a PDF with form elements, add some data and export it again to a new PDF file. The code to export this file looks like this:
@IBAction func exportPDF(_ sender: Any) {
guard let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first,
let data = pdfView.document?.dataRepresentation() else {return}
let fileURL = url.appendingPathComponent("test.pdf")
do {
try data.write(to: fileURL, options: .atomicWrite)
print(fileURL)
} catch {
print(error.localizedDescription)
}
}
Everything is working fine and opening the file in PDF readers looks good as well, but when I am opening the file in Adobe Acrobat (on PC or Mac) the file somehow seems to be corrupted. All formfields are behind the text and I can't edit the form anymore. This is only happening since I updated my Mac to OS Catalina running Xcode 11.2. Is anyone having the same issue?
来源:https://stackoverflow.com/questions/58860015/saved-pdfview-with-pdfkit-ios-not-showed-properly-in-adobe-reader