使用PDFKit界面显示pdf文件 [英] Displaying pdf files using the PDFKit interface

查看:369
本文介绍了使用PDFKit界面显示pdf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Mac OS 10.12上工作,并且有一个使用PDFKit界面显示pdf文件的应用程序. 但是我遇到了以下问题

I am working on a Mac OS 10.12, and have an application to display pdf files using the PDFKit interface. But I encountered the following issues

在原始操作系统中,例如,将pdf文档设置为PDFView. OS10.11中,将调用PDFView-> drawPage()函数,但在OS10.12中,不调用该函数;

Set pdf document to PDFView, in original OS,e.g. OS10.11 , there will invoke PDFView->drawPage() function, but in OS10.12,the function is not invoked;

PDFView can't draw pdf annotation in OS10.12;

以上解决方案将不胜感激

Solution to the above will be appreciated

推荐答案

我认为这是一个直接的bug或尚未记录的API更改.我将其记录为错误(27666426),现在可以看到它被标记为开放副本(27668895).

I reckon this is either a straight out bug or an as yet undocumented API change. I logged this as a bug (27666426) and can see now that it is being flagged as an open duplicate (27668895).

请注意,在10.12 Beta 6中,-drawWithBox:toContext:会被调用,以代替现在已弃用的-drawWithBox:.请注意,对于所有图形,还必须使用传入的上下文.

Note that of 10.12 Beta 6 -drawWithBox:toContext: gets called in place of the now deprecated -drawWithBox:. Note that it is also necessary to use the passed in context for all drawing.

更新:

但是,随着10.12的发布,事情似乎并不那么简单.我发现从10.11的-drawWithBox:和10.12+的-drawWithBox:toContext:退出的PDF视图打印已损坏.

However things do not seem that simple with the 10.12 now that it is released. I find that my PDF view printing, which is driven off of -drawWithBox: on 10.11 and -drawWithBox:toContext: on 10.12+ is broken.

单步执行汇编程序,可以看到在打印时10.12现在调用-drawWithBox:inContext:而不是-drawWithBox:toContext:-drawWithBox:(就像10.11一样).似乎inContext:选择器已经

Stepping through the assembler I can see that 10.12, when printing, now calls -drawWithBox:inContext: not -drawWithBox:toContext: or -drawWithBox: (as was the case on 10.11). It would seem that the inContext: selector has been around a while.

看来,唯一适用于10.9-10.12屏幕和打印效果的解决方案是使用未记录的-drawWithBox:inContext:.

It would seem that the only solution that works on 10.9 - 10.12 for both screen and print renders is to use the undocumented -drawWithBox:inContext:.

这篇关于使用PDFKit界面显示pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆