• 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: NSTextView and Html path to images ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView and Html path to images ?


  • Subject: Re: NSTextView and Html path to images ?
  • From: Frédéric Testuz <email@hidden>
  • Date: Sat, 2 Jul 2005 18:14:30 +0200


Le 2 juil. 05, à 17:57, Yvon Thoraval a écrit :


Le 2 juil. 05 à 17:20, Tommy Nordgren a écrit :

You need to provide a relative path, starting from the directory that contains the html
like this:


MyDir/
    htmlfiles/
        MyFile.html
    Resources/
        myImage.png

in MyFile.html write this:
<img src="../Resources/myImage.png" />

Jul 2, 2005 kl. 4:52 PM skrev Yvon Thoraval:

thanks for your answer, however, may be that's the reason for the probs, my "html" is programmatically given here is part of the code (Cocoa-Java) :


String theText = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\";>";
theText += "<html lang=\"fr\">";
theText += "<head>";
[...]
theText += " <body>";
theText += " <div id=\"containerG\">";
theText += " <h1>" + name + " (" + gend + ")" + "</h1>";
//theText += " <img src=\"" + pathToResources + "/images/vineplants/" + imag + "\" />";

Are you sure the result path in src is in the form src="file:///Applications/..." and not src="/Applications/..." ?


//theText += " <h5>" + pathToResources + "/images/vineplants/" + imag + "</h5>";
theText += " </div>";
[...]
theText += " </body>";
theText += "</html>";
theText = StringTK.fromMacOSRoman(theText);
NSData htmlData = new NSData(theText.getBytes());
NSAttributedString s = new NSAttributedString(((NSData) htmlData), new NSMutableDictionary());
vinePlantTextView.textStorage().setAttributedString(s);


with :

pathToResources = NSBundle.mainBundle().resourcePath();

vinePlantTextView  an NSTextView

remarks if  i want to put the same image in an NSImageView like that :

img = new NSImage(pathToResources + "/images/tables/Addresses.tif", true);
vinePlantImage.setImage(img);


vinePlantImage being the NSImageView

that's work fine but i don't want this kind of design, only html, in that case...

Yvon

Fred

_______________________________________________
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: NSTextView and Html path to images ?
      • From: Yvon Thoraval <email@hidden>
References: 
 >NSTextView and Html path to images ? (From: Yvon Thoraval <email@hidden>)
 >Re: NSTextView and Html path to images ? (From: Yvon Thoraval <email@hidden>)

  • Prev by Date: Re: NSSearchField problem under 10.3
  • Next by Date: Core Data, saving XML store is OK, loading is not
  • Previous by thread: Re: NSTextView and Html path to images ?
  • Next by thread: Re: NSTextView and Html path to images ?
  • Index(es):
    • Date
    • Thread