• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How do I create a PDF fle paginated according to my own rules?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I create a PDF fle paginated according to my own rules?


  • Subject: Re: How do I create a PDF fle paginated according to my own rules?
  • From: John Calhoun <email@hidden>
  • Date: Thu, 28 Aug 2008 18:27:28 -0700

On Aug 28, 2008, at 5:51 PM, Paul Archibald wrote:
But this does not seem to be possible. The PDFDocument and PDFPage classes seem to have a weird relationship, where you can get a page from a document, or add/remove a page, but there does not seem to be any way to create a PDFPage and draw or set text into it directly.

You can by subclassing.

1) Create a class: MyPDFTextPage (or whatever) as a subclass of PDFPage.
2) Implement/override -[PDFPage boundsForBox:] and return the size you want for your PDF page (in points).
3) Implement/override -[PDFPage drawWithBox:] to draw whatever text you wish, in whatever color, font or point size you wish.
4) Add this page to an empty PDFDocument.


So there are some things I left out above. For example, your subclass will need a settor or initializer to specify the text/font/etc. And of course instance variables to store this info.

This will work.  And it will be fast as well.

John Calhoun—_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >How do I create a PDF fle paginated according to my own rules? (From: Paul Archibald <email@hidden>)

  • Prev by Date: How do I create a PDF fle paginated according to my own rules?
  • Next by Date: Re: NSXMLNode and NSXMLElement issue
  • Previous by thread: How do I create a PDF fle paginated according to my own rules?
  • Next by thread: NSNumberFormatter
  • Index(es):
    • Date
    • Thread