By using below code I'm able to load the pdf. Then I have added an add signature button at navigation bar. On click of the add signature button should allow me to browse the signature image then after click the add button it should add the signature on the pdf and back to first view controller.
or in the first view controller when the pdf is displaying how to draw a signature
import UIKit
import PDFKit
class ViewController: UIViewController { @IBOutlet weak var pdfContainerView: PDFView!
override func viewDidLoad() {
super.viewDidLoad()
self.title = "PDF Viewer"
setupPdfView()
}
func setupPdfView() {
if let path = Bundle.main.path(forResource: "sample", ofType: "pdf") {
if let pdfDocument = PDFDocument(url: URL(fileURLWithPath: path)) {
pdfContainerView.displayMode = .singlePageContinuous
pdfContainerView.autoScales = true
pdfContainerView.displayDirection = .vertical
pdfContainerView.document = pdfDocument
}
}
}
}