I have generated the PDF using the below code
let pdfData = NSMutableData()
UIGraphicsBeginPDFContextToData(pdfData, CGRect(x: 0, y: 0, width: 1024, height: 768), nil)
guard let pdfContext = UIGraphicsGetCurrentContext() else { return }
for view in PdfPages {
UIGraphicsBeginPDFPage()
view.layer.renderInContext(pdfContext)
}
UIGraphicsEndPDFContext()
I want to know if there is any way by which I can compress the PDF. Note: I am not using any image in any of my PdfPages. Thanks in advance.