iOS-PDF-Reader icon indicating copy to clipboard operation
iOS-PDF-Reader copied to clipboard

How to disable download / copy / print options dialog

Open iamdeadman opened this issue 5 years ago • 2 comments

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 ?

iamdeadman avatar Apr 03 '19 16:04 iamdeadman

@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)
    }

kobenguyent avatar Apr 09 '19 07:04 kobenguyent

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

iamdeadman avatar Apr 10 '19 05:04 iamdeadman