• 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: NSAttributedString and PDF
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAttributedString and PDF


  • Subject: Re: NSAttributedString and PDF
  • From: Douglas Davidson <email@hidden>
  • Date: Mon, 29 Jan 2007 09:46:35 -0800


On Jan 27, 2007, at 4:26 AM, Julio Cesar Silva dos Santos wrote:

I would like to know if there is a way of saving an NSAttributedString into PDF format. This NSAttributedString comes from an NSTextView and I know that Views have the dataWithPDFInsideRect: method but when I save it to a PDF file it becomes weird (no margins, for example).
My code so far:


PDFDocument * myPDF = [[PDFDocument alloc] initWithData:[myTextView dataWithPDFInsideRect:[myTextView bounds]]];
[myPDF writeToFile:[@"~/Documents" stringByExpandingTildeInPath]];


If I get the data of the NSAttributedString (using dataFromRange:) the PDF document is not created because it lacks the '%PDF' tag.

Am I getting the right approach? Any suggestion will be welcomed.

Writing to a PDF is essentially equivalent to printing, so you should probably look in that direction. You might look at the TextEdit sources, for example, for the handling of print info.


Douglas Davidson

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >NSAttributedString and PDF (From: Julio Cesar Silva dos Santos <email@hidden>)

  • Prev by Date: Re: NSButton Text Color?
  • Next by Date: NSViewAnimation and fading in NSWindow
  • Previous by thread: NSAttributedString and PDF
  • Next by thread: Re: NSAttributedString and PDF
  • Index(es):
    • Date
    • Thread