Skip navigation.
 
mlRe: How do I create a PDF fle paginated according to my own rules?
FROM : John Calhoun
DATE : Fri Aug 29 03:27:28 2008

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_removed>)

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:
http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>

This email sent to <email_removed>

Related mailsAuthorDate
mlHow do I create a PDF fle paginated according to my own rules? Paul Archibald Aug 29, 02:51
mlRe: How do I create a PDF fle paginated according to my own rules? John Calhoun Aug 29, 03:27