0

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);
skaffman
  • 398,947
  • 96
  • 818
  • 769
zhouxiang
  • 153
  • 3
  • 12
  • What do you mean by ‘compress the pdf's image to jpeg2000’? Does `filename` point to a PDF document file or to a JPEG 2000 image file? –  Jan 09 '11 at 21:46
  • the pdf contains some images.but the images are all encoded into jped2000.i use CGPDFDocumentRef to draw pdf,but don't draw the images at all.thanks Bavarious – zhouxiang Jan 09 '11 at 21:54

1 Answers1

0

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.

steipete
  • 7,581
  • 5
  • 47
  • 81