Skip to content

Instantly share code, notes, and snippets.

@iosdevie
Created May 26, 2021 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iosdevie/d93d7547e6f245147204f46c96959f70 to your computer and use it in GitHub Desktop.
Save iosdevie/d93d7547e6f245147204f46c96959f70 to your computer and use it in GitHub Desktop.
Saving PDFDocument to the documents directory in iOS
let data = pdfDocument.dataRepresentation()
let documentDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
let docURL = documentDirectory.appendingPathComponent("Scanned-Docs.pdf")
do{
try data?.write(to: docURL)
}catch(let error){
print("error is \(error.localizedDescription)")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment