UIActivityViewController with PDF file in Swift

207 Views Asked by At
import UIKit
import WebKit
class MGENVC00004: UIViewController{ 
//button action 
@IBAction func shareTextButton(_ sender: UIButton) {
let db = CommDB()
let sql = "select CW_VAL " +
"from CW99MM000080 " +
"where cw_s_module = '33' " +
"and cw_s_ind = 'MLET_PRIVACY'"
db.query(sql)

let urlVal = db.getDataAt(0, "CW_VAL")

let URL:NSURL = NSURL(string: urlVal!)!

let vc = UIActivityViewController(activityItems:[URL], applicationActivities: [ ])

    vc.popoverPresentationController?.sourceView = self.view

    vc.excludedActivityTypes = [ UIActivityType.airDrop, UIActivityType.postToFacebook ]

    self.present(vc, animated: true, completion: nil)

}
override func viewDidLoad() {
super.viewDidLoad()

let sql = "select CW_VAL " +
"from CW99MM000080 " +
"where cw_s_module = '33' " +
"and cw_s_ind = 'MLET_PRIVACY'"

db.query(sql)

let urlVal = db.getDataAt(0, "CW_VAL")

let url = URL(string: urlVal!)
webView.loadRequest(URLRequest(url: url!))

}

}

hi anyone can help ? if my param is URL link of PDF. Can i able to use UIActivityType.airDrop, UIActivityType.addToReadingList, UIActivityType.openInIBooks and UIActivityType.print ??? when i try at simulator only got copy show.

please help

0

There are 0 best solutions below