How can I set the crop and bleed box in beginPDFPage(CFDictionary)?

Hi,


I want to create a PDF where the pages have different sizes. If needed I could set a common mediaBox and just specific bleed and crop boxes for each page. Here is how I create the context and a page

if let context = CGContext(url as CFURL, mediaBox: nil, nil) {
  var pageDescription: [CFString:Any] = [:]
  pageDescription[kCGPDFContextMediaBox] = mediaBox
  pageDescription[kCGPDFContextBleedBox] = mediaBox
  pageDescription[kCGPDFContextCropBox] = cropBox
  context.beginPDFPage(pageDescription as CFDictionary)


Sadly it looks like nothing is stored in the PDF.

I am able to add these informations if I load the document into a PDFDocument after printing, but there must be a direct way, right?


All the best

Christoph

How can I set the crop and bleed box in beginPDFPage(CFDictionary)?
 
 
Q