how to implement pdf editor

前端 未结 1 1135
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-15 14:05

I am working on an application and I am using pdfkit which I should have the ability to read pdf files and edit them. I found that iOS has an editor like the image

1条回答
  •  悲哀的现实
    2021-02-15 14:24

    func createAndEditPDF() {
    
            let pdfURL = NSURL(fileURLWithPath: self.selectedFile.fileURL); // URL of the existing PDF 
            if let pdf:CGPDFDocument = CGPDFDocument(pdfURL as CFURL) { // Create a PDF Document
                let _newURL = "\(documentFolderPath)/\(self.selectedFile.name)"; // New URL to save editable PDF
                let _url = NSURL(fileURLWithPath: _newURL)
                var _mediaBox:CGRect = CGRect(x: 0, y: 0, width: pageWidth, height: pageHeight); // mediabox which will set the height and width of page
                let _writeContext = CGContext(_url, mediaBox: &_mediaBox, nil) // get the context
    
                //Run a loop to the number of pages you want
                for i in 0..

    0 讨论(0)
提交回复
热议问题