Lessons learned from eaGeier #2

Creating a PDF File

The eaGeier allows to print its data or to export it via email as PDF file. For both it needs to create a PDF file first.

Creating a PDF file works straightforward following the instructions of the documentation at Apple. Start by opening a new file and start with a page:

UIGraphicsBeginPDFContextToFile(pdfFileName, CGRectZero, nil);
UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, 612, 792), nil);

Note that the values 612 x 792 define a page in US letter format. An A4 page needs appropriate adjusting (595.28 x 841.89). The second command is called for every new page you want to add to the file.

To close the PDF file and write it out use


Filling the PDF files works using CGContext drawing functions.


Flattr this!

Leave a Reply

Your email address will not be published. Required fields are marked *