gpt4 book ai didi

iphone - pdf 颠倒生成

转载 作者:搜寻专家 更新时间:2023-10-30 20:10:07 27 4
gpt4 key购买 nike

我正在使用以下代码创建 pdf

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;

但它是倒置的,即 180 度镜像。

这里有什么问题吗?

最佳答案

将 PDF 上下颠倒:

CGAffineTransform aCgAffTrans = CGAffineTransformMakeTranslation(0,892); //here the whole PDF page height should be given 
aCgAffTrans = CGAffineTransformScale(aCgAffTrans, 1.0, -1.0);
CGContextConcatCTM(aCgPDFContextRef, aCgAffTrans);

您提供了一些随机高度,而某些部分被调低而其他部分保持不变。于是出现了镜子般的效果。

关于iphone - pdf 颠倒生成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13952392/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com