Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Pod/Classes/Renderer/PDFRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ open class PDFRenderController {
let documentRef = document.documentRef
let pages = document.pageCount
let title = document.fileUrl?.lastPathComponent ?? "annotated.pdf"
let documentInfo = {() -> Dictionary<CFString, String>? in
guard let password = document.password else { return nil }
return [kCGPDFContextUserPassword: password, kCGPDFContextOwnerPassword: password]
}()
let tempPath = NSTemporaryDirectory() + title

UIGraphicsBeginPDFContextToFile(tempPath, CGRect.zero, nil)
UIGraphicsBeginPDFContextToFile(tempPath, CGRect.zero, documentInfo)
for i in 1...pages {
let page = documentRef?.page(at: i)
let bounds = document.boundsForPDFPage(i)
Expand Down