Please help, I'm trying to create a Multi paged pdf in objective-c based on the objects of an array, the problem is that the first page of the pdf sets out the text of the objects fine, but when it gets to the second page the text begins again towards the bottom of the page, I've tried resetting the newOriginY value but this gets ignored unless I specify for which index of an object, I just want to data to continue onto the second page starting at the top, here is the code:
// Table setup
CGRect frame;
int newOriginX = 0;
int newOriginY = 0;
for (int i = 0; i < [allInfo count]; i++){
NSArray *infoToDraw = [allInfo objectAtIndex:i];
for (int j = 0; j < numberOfColumns; j++){
if (j == 1) {
newOriginX = origin.x + (j * columnWidth + 80);
}
else if (j == 3){
newOriginX = origin.x + (j * columnWidth - 60);
}
else{
newOriginX = origin.x + (j * columnWidth);
}
newOriginY = origin.y + ((i + 1) * rowHeight);
if (i == 12) {
newOriginY = 0;
origin.y = 0;
}
frame = CGRectMake(newOriginX + padding, newOriginY + padding, columnWidth, rowHeight);
// Draw the text
[self drawText:[infoToDraw objectAtIndex:j] inFrame:frame];
}
// Create new page
if (i == 11) {
UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 44, 540, 600), nil);
}
}