Posts

Post not yet marked as solved
0 Replies
1.1k Views
What is wrong with this code, on Ventura… it was OK since PDFKit exists, producing a PDF with one page, with a square... but now, a blank page ? import PDFKit let rect = NSRect(x: 0, y: 0, width: 100, height: 100) let newImage = NSImage(size: rect.size, flipped: false) { (_: NSRect) -> Bool in let path = NSBezierPath(rect: NSRect(x: 10, y: 10, width: 80, height: 80)) path.stroke() return true } let outPDF = PDFDocument() guard let pdfPage = PDFPage(image: newImage) else { fatalError("pdfPage") } outPDF.insert(pdfPage, at: 0) let outURL = URL(fileURLWithPath: "out.pdf") outPDF.write(to: outURL) Any help is welcome.
Posted Last updated
.