donny.rewq
donny.rewq

Reputation: 641

TPPDF Landscape document

I am using TPPDF to generate a PDF in swift. How do you create a PDF in landscape mode. I found the variable "landscapeSize" in PDFPageFormat but not sure how to use it.

Upvotes: 0

Views: 212

Answers (1)

Philip Niedertscheider
Philip Niedertscheider

Reputation: 1069

you can either create a PDFDocument using the format option, or as an alternative pass a full layout. Therefore the easiest way is probably the following:

let document = PDFDocument(format: .a4)
var layout = PDFPageFormat.a4.layout
layout.size = PDFPageFormat.a4.landscapeSize
let document = PDFDocument(layout: layout)

Upvotes: 1

Related Questions