![]() It passes the PDF data to the destination PDFPreviewViewController. This method creates the PDF when the user calls the segue on the Preview button. Vc.documentData = pdfCreator.createFlyer() Let renderer = UIGraphicsPDFRenderer(bounds: pageRect, format: format) Let pageRect = CGRect(x: 0, y: 0, width: pageWidth, height: pageHeight) Let format = UIGraphicsPDFRendererFormat()įormat.documentInfo = pdfMetaData as Now, add this new method to create the PDF to PDFCreator: Add the following under import UIKit at the top of the file: To use PDFKit, you need to import it into the class. Ensure the Language is set to Swift.įinally, click Next and then Create. Once you’ve done that, name the class PDFCreator and make it a subclass of NSObject. In the project choose File ▸ New ▸ File… and select the iOS ▸ Cocoa Touch Class template. Next, you’ll create a new class to encapsulate the process of building a PDF.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |