Displaying pdf files using the PDFKit interface

岁酱吖の 提交于 2019-12-12 19:13:02

问题


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

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


回答1:


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).

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.

UPDATE:

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.

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.

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:.



来源:https://stackoverflow.com/questions/38517984/displaying-pdf-files-using-the-pdfkit-interface

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!