PDFKIT IOS 11 A4 Size to Save Swift
Asked Answered
S

1

5

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

Smyrna answered 11/3, 2018 at 20:52 Comment(0)
F
10

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...
  }
Fantastic answered 15/1, 2019 at 15:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.