Trip expense reports leave a travel app as PDFs, each with a title, a handful of amounts and a notes field that a traveler can fill with one sentence or with two pages about a canceled flight out of Lisbon. The short reports always look right. The long ones raise a question the drawing code has to answer itself, which is when page two begins.
We are preparing an iOS edition of IronPDF for iPhone and iPad apps, coming soon, with early-access sign-up. Meanwhile, the report is drawn with Apple's own UIGraphicsPDFRenderer.
We work at Iron Software, and the end of this article covers our library, IronPDF.
How does UIGraphicsPDFRenderer draw the first page?
It takes a page size and a closure of drawing instructions and returns the PDF. UIGraphicsPDFRenderer is the UIKit class for creating PDFs, with Swift and Objective-C interfaces, and its drawing closure runs against a Core Graphics context that the renderer creates.
// The renderer takes the page bounds, and the closure holds every drawing instruction.…