2

I am using CGContextDrawPDFPage to draw pdfs in a layer using standard techniques as mentioned here . The PDF Viewing is perfect for most of the pdfs. However FreeText Annotations in the PDF are not rendered at all. QLPreviewController successfully displays them but i can't use it as its not customizable for my use cases. Is there a way to Render Free Text Annotations using CGPDF?

Community
  • 1
  • 1
Qamar Suleiman
  • 1,228
  • 2
  • 18
  • 31

1 Answers1

1

I'm actually surprised that you managed to create annotations that are rendered by Apple's QLPreviewController. It uses CorePDF under the hood (just like Safari/UIWebView) and as of iOS 7 has some support for PDF annotations, as long as they are backed by appearance streams, however in our experimentation (and I work in the PDF space since 2010 on the PSPDFKit SDK) most annotations are not rendered with Apple's library, not even as of iOS 9.3.

We submitted a few radars against this behaviour as it often comes up on support, when people use our PDF product to annotate documents on their iPad and then send it via email and other people open it via Mail.app on another iOS device and can't see the annotations. We even wrote a support article for this behaviour.

Alternatively, you can flatten your document and render the annotations as part of the PDF content. This makes them no longer editable (unless you edit the content stream directly) but will be correctly rendered even by less capable renders such as Apple's CoreGraphics PDF engine. There are many products on the server that allow that such as iText, and our own SDK can do that via the PSPDFProcessor class.

steipete
  • 7,581
  • 5
  • 47
  • 81