How can I create a PDF file programmatically in an iOS application?

前端 未结 4 1010
Happy的楠姐
Happy的楠姐 2020-12-05 11:48

How to generate a PDF file on a user action?

相关标签:
4条回答
  • 2020-12-05 12:33

    As an example of creating a PDF from the contents of a CALayer, you can refer to the -dataForPDFRepresentationOfLayer method within the CPLayer class in the Core Plot framework. You can do something similar to extract the content from a CALayer-backed UIView, although we had to subclass CALayer in order to get vector elements to render to a PDF properly.

    0 讨论(0)
  • 2020-12-05 12:50

    See "Drawing with Quartz" to see how to create a PDF Graphics Context.

    Some notes:

    "iPhoneOSNote: If you want to create a PDF graphics context in an iPhone application, make sure you also read “Drawing to a Graphics Context in iPhone OS” (page 27)."

    "You can write any content to a PDF that’s appropriate for your application—images, text, path drawing—and you can add links and encryption. For more information see “PDF Document Creation, Viewing, and Transforming” (page 177)."

    0 讨论(0)
  • 2020-12-05 12:50

    Use this library to generate pdf file by programmatically.

    SJ_PDFCreator

    0 讨论(0)
  • 2020-12-05 12:50

    Use a web service on a server back end to post the data to - then generate the PDF and return it to the browser/app with the correct mime type to open as a PDF.

    ColdFusion could easily do this for you in just a few lines of code.

    0 讨论(0)
提交回复
热议问题