Can someone please explain to me why I am only getting the contents of the visible view area rendered to pdf in Swift

 func renderPDF() {

let containerView = waiverViews.containerView
let pageDimensions = containerView.bounds
let pageSize = CGRect(x: 0, y: 0, width: 612, height: 792)
let pageCount = Int(ceilf(Float(pageDimensions.height / pageSize.height)))
let outputData = NSMutableData()

let pageRect = CGRect(x: 0, y: 20, width: 612, height: pageDimensions.height / 6)

UIGraphicsBeginPDFContextToData(outputData, .zero, nil)

if let context = UIGraphicsGetCurrentContext() {

    for i in 0...pageCount {
        
        let offset = CGFloat(i) * pageRect.width
        
        UIGraphicsBeginPDFPage()
        context.saveGState()
        context.translateBy(x: 0, y: -offset)
        context.scaleBy(x: 0.56, y: 0.56)
        containerView.layer.render(in: context)
        
        context.restoreGState()
    }
}

UIGraphicsEndPDFContext()
savePdf(data: outputData)

}

now vs expected image might be useful to help you out

Do you have an example you could show

Line.playground.zip (2.0 KB)

@wurllink Do you still have issues with this?

Yes I do, I was never able to solve it