Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

7. Working with Images > Drawing into PDF Files

Drawing into PDF Files

You can draw directly into PDF documents, just as if you were drawing into an image context. As you can see in Listing 7-4, you can use Quartz drawing commands such as UIImage’s drawInRect: and CALayer’s renderInContext: methods, along with your full arsenal of other Quartz functions.

You’ll typically draw each image into a new PDF page. You must create at least one page in your PDF document, as shown in this listing. In addition to simple rendering, you can add live links to your PDFs using functions such as UIGraphicsSetPDFContextURLForRect(), which links to an external URL from the rectangle you define, and UIGraphicsSetPDFContextDestinationForRect(), which links internally within your document. Create your destination points using UIGraphicsAddPDFContextDestinationAtPoint().


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint