【问题标题】:PDFKIT IOS 11 A4 Size to Save SwiftPDFKIT IOS 11 A4 大小以保存 Swift
【发布时间】:2018-03-11 20:52:21
【问题描述】:

我有一个 PDF 套件,我想将文件保存为 A4 尺寸

这是我的代码

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)

如何在 A4 中设置一个 Standard Class 的尺寸

【问题讨论】:

    标签: ios swift swift4 ios11 pdfkit


    【解决方案1】:

    在我的一个项目中,我使用了这种方式。

      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...
      }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-04-22
      • 2011-12-11
      • 2013-12-20
      • 2018-05-28
      • 2017-10-08
      • 2013-02-21
      • 2019-07-21
      相关资源
      最近更新 更多