Skip to content

Open PDF when it is encrypted with copy or print access #618

Description

@FabriceLeger

If a PDF is encrypted for IOS the method return nil.
But if we have right access to open it in read mode, the PDF can't open.

Could you modify this method in SwiftPdfxPlugin.swift to allow this:

func openFileDocument(pdfFilePath: String) -> CGPDFDocument? {
let docment = CGPDFDocument(URL(fileURLWithPath: pdfFilePath) as CFURL)

    if docment?.isEncrypted == true {
        // we check if PDF is allowed in copy or print mode to open it
        if(docment?.allowsPrinting == true || docment?.allowsCopying == true) {
            return docment
        }
        return nil
    }
    return docment
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions