I have one PDF Kit I want to save the File in A4 Size
here is my code
let newPagetxt = PDFPage(image:image!)
let apdf = PDFDocument()
apdf.insert(newPagetxt!, at:index)
apdf.documentAttributes!["Title"] = sampleFilenameTitle
apdf.documentAttributes!["Author"] = sampleFilenameAuthre
apdf.write(to: destination)
how can to set te size in A4 with one Standard Class
In one of my projects, I used this way.
if let pdfPage = PDFPage(image: image) {
let page = CGRect(x: 0, y: 0, width: 595.2, height: 841.8) // A4, 72 dpi
pdfPage.setBounds(page, for: PDFDisplayBox.artBox)
let pdfDoc = PDFDocument()
pdfDoc.insert(pdfPage, at: 0)
// Some code to save the doc...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With