вы можете преобразовать что-то вроде,
func createPdfFromView(aView: UIView, saveToDocumentsWithFileName fileName: String)
{
let pdfData = NSMutableData()
UIGraphicsBeginPDFContextToData(pdfData, aView.bounds, nil)
UIGraphicsBeginPDFPage()
guard let pdfContext = UIGraphicsGetCurrentContext() else { return }
aView.layer.renderInContext(pdfContext)
UIGraphicsEndPDFContext()
if let documentDirectories = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).first {
let documentsFileName = documentDirectories + "/" + fileName
debugPrint(documentsFileName)
pdfData.writeToFile(documentsFileName, atomically: true)
}
}
Read this article для более подробной информации и знать, что, как сделать это в различных размерах.
Добавьте свое мнение в прокрутку с исправлением A4. –
Используйте UIGraphicsBeginPDFContextToFile для преобразования в PDF и печати. http://stackoverflow.com/q/11809133/742298 –
i wan to scale UIVIew to A4 Формат бумаги –