CGPDFDocument无法绘制jpeg2000?
嗨,大家好。 我正在使用此代码绘制pdf,但我已将pdf的图像压缩为jpeg2000。因此cgpdfdocument无法解码jpeg2000,仅显示注释但空白。我怎样才能使其解码jpeg2000? 谢谢。任何建议将不胜感激。
CGPDFDocumentRef document;
CGPDFPageRef page;
CGRect box;
document = MyGetPDFDocumentRef (filename); // 1
page = CGPDFDocumentGetPage (document, pageNumber); // 2
CGContextDrawPDFPage (myContext, page); // 3
CGPDFDocumentRelease (document);
HI,guys.
I'm using this code to draw pdf,but i've compress the pdf's image to jpeg2000.so the cgpdfdocument can't decode the jpeg2000,just show noting but blank.how can i make it to decode the jpeg2000?
thanks.any advice will be gratefull.
CGPDFDocumentRef document;
CGPDFPageRef page;
CGRect box;
document = MyGetPDFDocumentRef (filename); // 1
page = CGPDFDocumentGetPage (document, pageNumber); // 2
CGContextDrawPDFPage (myContext, page); // 3
CGPDFDocumentRelease (document);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能是 Apple CoreGraphics 库中的一个错误。 Apple的引擎确实支持JPEG 2000,尽管解压缩代码非常慢,但它确实可以工作。
甚至还有一个开源示例 展示了如何解压缩JPEG 2000 using ImageIO - 然而,除了回答有关 JPEG 2000 兼容性的问题之外,这对您没有太大帮助。
我建议将带有错误 PDF 的雷达提交至radar.apple.com。
但是,不要指望这个问题会很快得到解决。多年来,当我们在商业 PSPDFKit SDK v1-v4 中使用 CoreGraphics PDF 渲染引擎时,我们报告了无数的渲染问题。随着去年的 v5 版本的发布,我们终于完成并切换到我们自己的渲染引擎,该引擎改进了 Apple 引擎存在的许多问题,特别是对于更奇特的文件或压缩格式。欢迎您尝试我们的 SDK 和渲染引擎,如果您发现在 Adobe Acrobat 中渲染的文件,也请向我们报告错误但不是我们的 SDK - 我们现在在兼容性方面非常出色,并且受到 Dropbox 或 IBM 等主要品牌的信任。
This is likely a bug in Apple's CoreGraphics library. Apple's engine definitely does support JPEG 2000, even though the decompression code is very slow, it certainly works.
There's even an open source example that shows how to decompress JPEG 2000 using ImageIO - however that will not help you much other than answering the question on JPEG 2000 compatibility.
I recommend submitting a radar with the faulty PDF to radar.apple.com.
However, don't get your hopes up that this will be fixed anytime soon. Over the years we reported countless rendering issues with the CoreGraphics PDF render engine as we used it in the commercial PSPDFKit SDK v1-v4. With last year's v5 release we finally finished and switched to our own rendering engine that improved on many of the problems that Apple's engine has, especially with more exotic files or compression formats. You're welcome to try our SDK and render engine and please report a bug to us as well if you find a file that renders in Adobe Acrobat but not our SDK - we're really good in terms of compatibility now and trusted by major brands such as Dropbox or IBM.