• 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: NSAttributedText initWithHTML: can you preserving html links
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAttributedText initWithHTML: can you preserving html links


  • Subject: Re: NSAttributedText initWithHTML: can you preserving html links
  • From: Nicko van Someren <email@hidden>
  • Date: Mon, 24 Apr 2006 13:14:07 +0100

On 24 Apr 2006, at 12:40, minapre999 wrote:

I have some code to convert html into pdf (code below). To do this I create an NSAttributedString object, using initWithHTML:, put the attributed string into a NSTextView, then use print objects to print the pdf to a file. I want to preserve the html links of the original file, as links in the final pdf document.

This isn't going to work because the printing process does not "print" the links, since it is only concerned with the appearance of the text.


The initWithHTML: method does not appear to convert the links into thean NSLinkAttributeName in the NSAttributedString

That should work; it works for me in a quick test here and it is the standard way to get links into things like the "About App..." dialogue.


(even if it did, I'm not sure if saving the text view as pdf would preserve it).

Does anyone know if cocoa can convert html to pdf, and preserve the links?

The only way I can think of doing this, and it's sort of ugly, is to make up the PDF file as you do at the moment and then load it back into an PDFDocument using PKDKit. Then you can extract the text, match up the text against your NSAttributedString, locate the link attributes and then attach PDFAnnotationLink objects to the matching texts. You can then save it back out with the link annotations. It's yucky, but it might work...


	Nicko

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSAttributedText initWithHTML: can you preserving html links
      • From: minapre999 <email@hidden>
References: 
 >NSAttributedText initWithHTML: can you preserving html links (From: minapre999 <email@hidden>)

  • Prev by Date: Re: Should Cocoa Apps have splash screens at all ?
  • Next by Date: Re: .Mac support to C/C++ application
  • Previous by thread: NSAttributedText initWithHTML: can you preserving html links
  • Next by thread: Re: NSAttributedText initWithHTML: can you preserving html links
  • Index(es):
    • Date
    • Thread