• 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 you create a new PDF file and write text to it?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do you create a new PDF file and write text to it?


  • Subject: Re: How do you create a new PDF file and write text to it?
  • From: John Calhoun <email@hidden>
  • Date: Wed, 6 Aug 2008 13:26:06 -0700

On Aug 6, 2008, at 11:37 AM, Paul Archibald wrote:
It looks like PDFKit is aimed at simply reading and navigating within an existing PDF file, but what I need to do is create a new PDF and write some simple text to it.

Sorry, I had to jump in and refute that — PDF Kit does allow PDF content creation, but it may not be so obvious looking at the API.


Subclassing PDFPage is a way to do this. Subclass and implement - [boundsForBox:] and -[drawWithBox:] and you're there. You report back the size of the PDF page in -[boundsForBox:] (in points where 72 == 1 inch) and you draw your text in the -[drawWithBox:] method.

You create an empty PDFDocument (alloc, init) and add your subclassed PDFPage to the document.


On Aug 6, 2008, at 11:42 AM, Charles Steinman wrote:
Easiest way: Create a view that draws what you want, send it - dataWithPDFInsideRect: and write that data to a file.

Charles is correct. And it is easiest. The PDF Kit method I outlined above gives you slightly more control over the resulting PDF (you can for example add metadata, multiple pages, differing crop/media boxes, etc.).


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 you create a new PDF file and write text to it? (From: Paul Archibald <email@hidden>)

  • Prev by Date: Re: How do you create a new PDF file and write text to it? LOOKS LIKE ITS SOLVED
  • Next by Date: Re: Rotate NSString... I give up :( [SOLVED]
  • Previous by thread: Re: How do you create a new PDF file and write text to it? LOOKS LIKE ITS SOLVED
  • Next by thread: Re: Rotate NSString... I give up :( [SOLVED]
  • Index(es):
    • Date
    • Thread