UIScrollView - CATiledLayer - PDF和Quartz绘图的组合

发布于 2024-10-14 13:10:01 字数 927 浏览 10 评论 0原文

我想在 iphone/ipad 项目中在完整的可缩放 pdf 上绘制线条、矩形等(因此不会造成质量损失)。

首先:我基于此示例:http://www.olivetoast.com/blog/2009/08/simple-uiscrollview-catiledlayer-pdf-example/ 此示例可以以完整质量缩放 PDF

第二: 我也基于此示例:http://www.iphonedevbook.com/forum/viewforum.php?f=1&sid=6d52a0d08a8c6a807cdedfde6a041088 本书的示例名为 QuartzFun。它用于绘制一条线,矩形,...

这两个示例完全独立工作,但是当我想将它们组合起来时,我无法绘制一条线... 为了让事情变得更简单,我已经在这里组合了代码: http: //www.megafileupload.com/en/file/297790/SimpleTiledScrollExample-1-zip.html

有人可以告诉我要更改什么才能使其正常工作吗?

提前致谢

I want do draw lines, rectangles, ... on a full zoomable pdf (so without quality loss) in an iphone/ipad project.

First: I have based me on this sample: http://www.olivetoast.com/blog/2009/08/simple-uiscrollview-catiledlayer-pdf-example/
This sample makes it possible to zoom on a PDF with full quality

Second: And i have also based on this sample: http://www.iphonedevbook.com/forum/viewforum.php?f=1&sid=6d52a0d08a8c6a807cdedfde6a041088
The sample named QuartzFun of this book. It's for drawing a line, rectangle, ...

These two samples are working perfectly separate, but when i want to combine them i can't draw a line...
For making thins more simple i have already combined the code here: http://www.megafileupload.com/en/file/297790/SimpleTiledScrollExample-1-zip.html

Can someone tell me what to change to let this work?

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

攒一口袋星星 2024-10-21 13:10:01

首先,不要使用 Quartz 在现有的 PDF 文件上绘图。它大部分情况下都可以工作,但是当原始文件中使用的字体在 iPhone/iPad 上不可用并且您得到各种结果时,它就无法正常工作。

其次,将在屏幕上绘制线条并将其写入 PDF 文件视为两个单独的操作。也就是说,使用 Quartz2D 将对象绘制到屏幕上的图层上,然后使用将屏幕上的对象转换为您选择的 PDF 库的 PDF 命令的功能进行 PDF 渲染。

PoDoFo 库是一个不错的选择,网上有关于为 iOS 编译它的信息。对于 PaperPad 我最初编写了自己的简单 PDF-Render 库,但它也会切换到 PoDoFo下次更新。

干杯,
发动机。

First of all, do not use Quartz to draw onto existing PDF files. It works mostly, but it doesn't work properly when the fonts used in the original file are not available on the iPhone/iPad and you get all kinds of results.

Secondly, think of drawing the lines on screen and writing them to a PDF file as two separate actions. That is, draw the objects on to a layer on the screen using Quartz2D and then for PDF-rendering use a function which translates the objects on your screen to PDF commands for the PDF-library of your choice.

The PoDoFo library is a good choice and there is information online about compiling it for the iOS. For PaperPad I had originally written my own simple PDF-Render library but it will also switch to PoDoFo in the next update.

Cheers,
Engin.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文