I am creating pdf using below code
UIImage *CurImage=[UIImage imageWithContentsOfFile:[ImageArr objectAtIndex:i]];
UIView *ViewDraw=[[UIView alloc]initWithFrame:CGRectMake(0,10, pageSize, pageSize)];
ViewDraw.backgroundColor=[UIColor clearColor];
CGContextBeginPage (pdfContext,nil);
//turn PDF upsidedown
CGAffineTransform transform = CGAffineTransformIdentity;
transform = CGAffineTransformMakeTranslation(0,CurImage.size.height);
transform = CGAffineTransformScale(transform, 1.0, -1.0);
CGContextConcatCTM(pdfContext, transform);
int y = (pageSize - CurImage.size.height)/2;
int x = (pageSize - CurImage.size.width)/2;
[CurImage drawInRect:CGRectMake( (ViewDraw.frame.width - curImage.frame.width)/2, 24, size.width, curImage.frame.height)];
// CGContextDrawImage(pdfContext, CGRectMake(x,-y, CurImage.size.width, CurImage.size.height), CurImage.CGImage);
CGContextEndPage (pdfContext);
CurImage=nil;
but it is generating upside down i.e.180 degree with mirror image.
What is wrong here?
Turn PDF upside-down:
CGAffineTransform aCgAffTrans = CGAffineTransformMakeTranslation(0,892); //here the whole PDF page height should be given
aCgAffTrans = CGAffineTransformScale(aCgAffTrans, 1.0, -1.0);
CGContextConcatCTM(aCgPDFContextRef, aCgAffTrans);
Your are providing some random height while some part gets turned down and others remains the same. So a mirror like effect appears.