pdf文件的缩放
查看 QuartzDemo 示例应用程序,我喜欢单独使用quartz(即不使用 uiwebview)渲染 PDF 的速度。然而,当我放大 PDF 时,它似乎并没有像在 PDF 视图中那样变得更加清晰。
Looking at the QuartzDemo sample application, I love the speed of the PDF rending using quartz alone (that is, without using uiwebview). However, when I'm zooming in the PDF it doesn't seem to become more clear like it does in PDF view.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
实现此目的的最简单方法是实现基于 CATiledLayer 的视图并将其添加为 UIScrollView 的子视图。
例如,将levelsOfDetail 设置为3,将levelsOfDetailBias 设置为2(一个缩小级别和两个放大级别)。
UIScrollView 和 CATiledLayer 类将为您完成所有工作:-)
The simplest way to do achieve this is to implement a CATiledLayer based View and add it as subview of a UIScrollView.
Set the levelsOfDetail to 3 and levelsOfDetailBias to 2 for example (one zoom out level and two zoom in level).
The UIScrollView and CATiledLayer classes will do all the job for you :-)
它实际上只是放大 PDF 的预渲染图像,因此类似于放大 png 或类似图像。要实际缩放 PDF,您需要以更大的比例因子重新渲染 pdf,并仅显示应该可见的矩形。
It's actually just zooming in on a pre-rendered image of the PDF, so it's akin to scaling up a png or similar. To actually zoom the PDF you need to re-render the pdf at a larger scale factor and display only the rect that should be visible.