PDA

View Full Version : Create a PDF file that includes Portrait and Landscape pages?




isthisonetaken
Feb 29, 2012, 03:46 PM
Hey guys,

I'm trying to create a pdf document in my app. So far, I can create the cover page and the page after that, which are both fine in portrait orientation. The pages after that I need to draw tables of information on, and would like them to be in Landscape orientation. I'm fine with the pages being in Portrait, but the content being sideways (hopefully you know what I mean by that). I'm just wondering how to go about getting the context set up so I can draw content into it like that? I have methods right now that let me specify the text and rect to draw in, which works great in portrait.

Any ideas how to go about doing this?

Thanks

EDIT:
I got this working. Basically, I reset the page size to the landscape size (792, 612) and created a rect to start at (0, 0) and have that width and height. Then instead of calling UIGraphicsBeginPDFPage(), which is what I was doing before, I called UIGraphicsBeginPDFPageWithInfo() and put in the landscape rect. It works, in that I get landscape pages, but they aren't rotated to fit onto a portrait page sideways and are scaled down to fit instead. Anyone know how to rotate a PDF page?