Re: NSTextView and Html path to images ?
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