title: Objective C - Create PDF (Mac OSX / Cocoa)
body: <p>I'm following this guide to create PDF but I don't understand what I have to code on myDrawnContent function : <a href="https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf/dq_pdf.html#//apple_ref/doc/uid/TP30001066-CH214-CJBFFHHA" rel="nofollow noreferrer">https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf/dq_pdf.html#//apple_ref/doc/uid/TP30001066-CH214-CJBFFHHA</a></p>
  
  <p>Using this guide I'm able to create a PDF with the function:</p>
  
  <blockquote>
    <p>-(void) MyCreatePDFFile:(CGRect)pageRect filename:(const char *)filename;</p>
  </blockquote>
  
  <p>I need to code the -(void)myDrawContent:(CGContextRef) pdfContext; I want to set a Tittle on the top, a NSImage and a NSString after the image, how i do that? </p>
  
  <p>Adiccionaly: for that I found this code:</p>
  
  <pre><code>NSString * path = @"/Users/admin/Downloads/prueba.pdf";
  PDFDocument * pdf = [[PDFDocument alloc]init];
  NSImage *image = [self getRepImage];
  PDFPage * page = [[PDFPage alloc ] initWithImage:image];
  [pdf insertPage:page atIndex: [pdf pageCount]];
  [pdf writeToFile:path];
  </code></pre>
  
  <p>It creates a pdf with a NSImage but I how do i add text ?
  Thank you</p>