I need to build pdf viewer but with 2 urls to pdfs file

After you take the data1 and data2 convert it PDF instances and you can use this function :

func combinePdf(data1: Data, data2: Data) -> PDFDocument {
        let pdfDocument = PDFDocument(data: data1)!
        let otherPdfDocument = PDFDocument(data: data2)!
        let newPdfDocument = PDFDocument()
        for p in 0..<pdfDocument.pageCount {
        let page = pdfDocument.page(at: p)!
            newPdfDocument.insert(page, at: newPdfDocument.pageCount)
        for q in 0..<otherPdfDocument.pageCount {
            let page = otherPdfDocument.page(at: q)!
            newPdfDocument.insert(page, at: newPdfDocument.pageCount)
        return newPdfDocument

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top