create pdf with a template pdf and add image, text, barcode, and complete field form , objective c, OS X

1.2k views Asked by At

I am a newbie at Objective-C. I'm working on a project for a OSX. I have a pdf template file with form fields, and I need to use it to generate a new pdf adding some images, text, barcode, and complete form fields.
I've been researching for working with PDFs, I'm trying to use Quartz 2D, CGPDFContext, and at this moment I managed to fill a new pdf with the page template, but I donĀ“t know how to do to write on the fields forms and add other images.
How can I draw at specific point, text or image? or exist any library to manage pdf? and for generate barcode128? Thank you so much!

1

There are 1 answers

15
Wain On

Once you have a CGPDFContext you can draw whatever you want into it as you would with any other context. A simple solution is to create a CALayer (or a view and then access its layer) with the content you want and then to draw that layer into your PDF context.

Getting the editable text fields isn't so easy, this might help.

If you can do away with the PDF template and do the whole thing as a view that you render into a PDF context that would be easier, but the process is generally the same once you know where you need to draw your additional text / graphics.