Alua-Kinzhebayeva / iOS-PDF-Reader

PDF Reader for iOS written in Swift
MIT License
532 stars 150 forks source link

How to disable download / copy / print options dialog #105

Open iamdeadman opened 5 years ago

iamdeadman commented 5 years ago

Hi,

Is there any option to disable, prevent or hide the download, print and copy options from the pdf document controller and also can we add custom authentication headers for loading the pdf documents. If so can you please point me in the direction as to how can it be done ?

kobenguyent commented 5 years ago

@iamdeadman that's possible to disable copy/print options with following code

    /// Presents activity sheet to share or open PDF in another app
    private func presentActivitySheet() {
        let controller = UIActivityViewController(activityItems: [document.fileData], applicationActivities: nil)
        controller.popoverPresentationController?.barButtonItem = actionButton
        controller.excludedActivityTypes = [ UIActivity.ActivityType.copyToPasteboard, UIActivity.ActivityType.print ] // this line to hide copy/print options
        present(controller, animated: true, completion: nil)
    }
iamdeadman commented 5 years ago

Okay, thanks for the help. I had another question when loading remote pdfs the view hangs before showing the pdf I think so is it possible to load the default empty view with a progress spinner or something until the pdf gets downloaded and rendered so that there are smooth transitions from my view controller to the pdf reader view controller