在 PDF 上绘制图像无法绘制经过变换的图像并且输出错误
我在 PDF 上绘制图像时遇到问题。我确实对图像应用缩放、旋转、移动等操作,并将该图像绘制在 PDF 上。但绘图无法正确输出。当我旋转图像时,它只是缩放而不旋转。
在这里,我更详细地解释一下: 我将图像放置在 UIWebView 上,以在 PDF 上准确地制作图像的假效果。然后,我在制作 PDF 时在 UIWebView 上的 PDF 上绘制图像。
但是,当我去准备带有修改后的图像的 PDF 时,该图像已经应用了很多转换,图像比例不会旋转。
这里,img_copyright是一个继承UIImageView的自定义类。
CGFloat orgY = (newY-whiteSpace)+img_copyright.frame.size.height;
CGFloat modY = pageRect.size.height-orgY;
CGFloat orgX = img_copyright.frame.origin.x-PDF_PAGE_PADDING_WIDTH;
CGFloat modX = orgX;
//We're getting X,Y of the image here to decide where to put the image on PDF.
CGRect drawRect = CGRectMake (modX, modY, img_copyright.frame.size.width, img_copyright.frame.size.height);
//Preparing the rectangle in which image is to be drawn.
CGContextDrawImage(pdfContext, drawRect, [img_copyright.image CGImage]);
[img_copyright release];
// Actually drawing the image.
但是当我看到 PDF 图像没有正确绘制到其中时。
您有何建议,是否是由于基于 X、Y 的图像绘制而导致的问题? 如果我们不依赖 X、Y,我们如何决定将图像放在 PDF 中的何处? 在PDF上通过旋转、缩放绘制图像的确切方法是什么?
当我将图像插入 UIWebView 的滚动条时的图像。 http://www.freeimagehosting.net/">
当我将图像绘制到 PDF 上时的图像。
http://www.freeimagehosting.net/">
I've a problem with drawing images on PDF. I do apply scaling, rotation, move, etc. to an image and draws that image on the PDF. But drawing is not outputting correctly. When I do rotate image, it just scales and doesn't rotate.
Here, I explain in more detail:
I place an image on UIWebView to make fake effect of image exactly on PDF. Then, I do draw image on PDF which is on the UIWebView while making PDF.
But when I go and prepare PDF with modified image, which has been applied lots of transformations, image scales not rotates.
Here, img_copyright is a Custom class inheriting UIImageView.
CGFloat orgY = (newY-whiteSpace)+img_copyright.frame.size.height;
CGFloat modY = pageRect.size.height-orgY;
CGFloat orgX = img_copyright.frame.origin.x-PDF_PAGE_PADDING_WIDTH;
CGFloat modX = orgX;
//We're getting X,Y of the image here to decide where to put the image on PDF.
CGRect drawRect = CGRectMake (modX, modY, img_copyright.frame.size.width, img_copyright.frame.size.height);
//Preparing the rectangle in which image is to be drawn.
CGContextDrawImage(pdfContext, drawRect, [img_copyright.image CGImage]);
[img_copyright release];
// Actually drawing the image.
But when i see the PDF image is not properly drawn into it.
What would you suggest, is it the problem due to image drawing based on its X,Y?
How could we decide where to put the image on PDF if we don't depend on X, Y?
What is the exact method of drawing image on PDF with rotation, scale?
The Image when I do insert the image onto UIWebView's scrollbar.
http://www.freeimagehosting.net/">
The Image when I do draw the image onto PDF.
http://www.freeimagehosting.net/">
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)