Displaying local image file in JEditorPane with relative path

Hi All,
I am showing an html inside JEditorPane. I have set its content type to text/html. The code goes like this,
StringBuffer bf=new StringBuffer();
bf.append("<html><head></head><body>");
bf.append("<img src=\"calendar.gif\" width=\"10\" height=\"10\" border=\"0\">");
bf.append(" <font face=\"Verdana\" size=\"3\">");
bf.append("Hi All");
bf.append("</font><br>");
bf.append("</body></html>");
jeditorpane.setContentType("text/html");
jeditorpane.setText(bf.toString());
The image calendar.gif is present at the base directory of the package. But still it is not shown in JEditorPane. But if i give full path like,
<img src="file://C:/man/calendar.gif">
then image appears.
Any idea like what is the document root for JEditorPane??
Thanks in Advance,
Manjinder Singh

One solution is to dynamically set the base href
String s = "test.txt"; // "dummy" file in current directory
File f = new File(s);
s = f.getAbsolutePath();
s = "file:\\"+s;
p("<BASE HREF='" + s + "'>");

Similar Messages

  • How can I allow a user (client) to choose a local image file (on his hard d

    How can I allow a user (client) to choose a local image file (on his hard drive) and modify it using an applet from his browser ? I am trying to develop a web page that enables the user to choose an Image file, manipulate the image using a java applet, and display the results.
    Using Java�s �JFileChooser� does not work when called from a browser, probably due to security privileges issues. On the other hand, I can choose and upload any file using a JavaScript form:
    <FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="process.asp">
    <INPUT TYPE=FILE NAME="file1"><BR>

    It seems that I can choose an image file with a Java script form and process an image with an applet. How can I choose a file AND process it locally ?
    (I do not wish to upload the file to the server using JavaScript form and then back to the client�s applet for processing since it will be a tremendous waste of resources).
    Will appreciate any solution.
    Thanks !
    ( my email is: [email protected] )

    "Using Java�s �JFileChooser� does not work when called from a browser, probably due to security privileges issues. "
    You can do this if you sign the applet...

  • How can i display a image file which is placed in the applications server

    Hi all,
    Can any one help me how can I display a image file which is present in the application server.
    With regards,
    M.Ramana Murthy

    hi,
    *& Form TOP_OF_PAGE
    * text
    FORM F_TOP_OF_PAGE.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = IT_LISTHEADER
    i_logo = Logo name
    * I_END_OF_LIST_GRID =
    ENDFORM. "TOP_OF_PAGE
    rgds
    Anver

  • Download/Display the image files stored at KM location: J2EE application

    Hi All
    Please let me know how to download/Display the image files stored at KM location on portal using J2EE application. Thanks.
    Best Regards
    P M

    You can use a servlet to deliver the image data to the <img tag, which allows you to get the data from something other than a file on the server (e.g. store the image data as a session attribute with a generated attribute key, the key being given in the serlvet's query string).

  • Acrobat X (10.0.2) trows Error when SaveAs with relative paths

    Hi,
    I'm wondering if this is a bug in Acrobat X.
    When I try to execute the script
    this.saveAs("../TEST.pdf"); or this.saveAs({cPath: "../TEST.pdf"}); it always throws this exception.
    UnsupportedValueError: Value is unsupported. ===> Parameter cPath.
    I did a cross-check with Acrobat 9, there both scripts are working fine and my file is saved into the parent directory.
    What's going on here?

    That's courious,
    a moment ago it doens't work.
    I thought, it may be because of an restriction to the system drive (C:\).
    So I tried it on another drive, but the same result, again, again, again...
    Now, after I killed the whole Acrobat processes it works on every drive, from the console and through a folder level script for local drives and also network paths.
    On another computer I got the exception again.
    But then, after I executed the saveAs once with an absolute path it also works with relative paths.
    What the hell?

  • How to display local HTML file in web-view?

    Hello everyone,
    we have no problem with showing of remote HTML content from server in box on page in web view. But how we can show such a content when included in HTMLResources? In guide is just "Display a local HTML file in an in-app browser", which works wihout problem, but we don't want to show this HTML content in in-app viewer, it should be part of page.
    Thanks
    Martin

    Now i'm confused. In guide is this:
    To use local HTML files, click the folder icon and specify the local HTML file. The HTML file (such as index.html) should appear in a folder that includes any images or scripts used in the HTML file.
    But no info where such a local HTML file should reside. If this file is in HTMLResources, it is ignored.

  • Displaying Encrypted Image File in Crystal Report

    Post Author: Riaz Afridi
    CA Forum: General
    Hi Folk,
    I have a problem to display an encrypted file in crystal report with transparent background.
    I have a column varbinary(Max)  in SQL Server Database which stores  image bytes. I have decrypted this column before displaying in crystal report. The report display the image but with a black background instead of transparent.
    Is there an answer to this ...
    Thanks

    I believe jpg and bmp images are supported

  • Links to PDF files with relative paths from a Captivate 4 project

    I'm creating a presentation in Captivate 4 (I'm making an exe file) with some links to PDF files; the links are buttons with the 'open URL or file' set. The presentation will be distributed in CDs and obviously the links will not work for they point to an absolute path in my PC. Is there another way to display external files? thanks

    "file:\file folder\filename" is not a relative path.  It's still an absolute path because you're specifying the path all the way from the root drive, whether you used a drive letter or not.
    A relative path shows where to find the other file in relation to the file that is calling it.
    Relative paths look like this:
    myDoc.doc (if the file is in the same directory as the file calling it)
    folderName/myDoc.doc (if the file is inside a folder in the same directory as the file calling it)
    ../myDoc.doc (if the file is located in the parent directory above the file that is calling it)
    ../../myDoc.doc (if the file is located two levels above the file that is calling it)
    etc
    Here's a tutorial that explains it better: http://www.communitymx.com/content/article.cfm?cid=230ad

  • Can the iPad display RAW image files?

    I know you can import RAW image files from a camera to the iPad.  Will the iPad be able to display the RAW image files?

    1) No you can't sync PDFs (Yes I know, this really annoys me too) I can sync and view a 700mb movie but can't sync and view a 1mb PDF, go figure. The only way I have found to save a PDF is to make a folder in my .Mac account then place an email with a PDF attachment into this folder. Now when you open it in Mail you can only view it in Portrait View (Vertical). So trying to read a PDF is almost impossible unless you enlarge it to the point where half the page is off the screen. Yea this phone has PDF support, but the worst, most limited support imaginable.
    2) Nope, you can't save PDFs from Safari (Or save anything else for that matter.)

  • Image File in CFGRID with Query

    I have a flash CFGRID populated with data from a query. I
    want to add a column to the grid that is not part of the query. I
    want the column to hold a small image file of an x that when
    clicked, deletes that row from the grid as well as the database
    itself. I know I can just use the built in edit mode with the one
    delete button at the bottom, but I prefer this way.
    I can not figure out how to add a column to the grid that is
    not part of the query to display the image.
    Is this even possible.

    One solution is to dynamically set the base href
    String s = "test.txt"; // "dummy" file in current directory
    File f = new File(s);
    s = f.getAbsolutePath();
    s = "file:\\"+s;
    p("<BASE HREF='" + s + "'>");

  • Firefox can't load a Siemens Gigaset network camera but IE8 can. There is an error in the code from the cam. Could Firefox ignore this and display the image anyway ? eg. with Ignore / Abort.

    I run Windows-XP SP3 and I can't get the image from a Siemans Gigaset cam. There is an error in the cam code (a lacking rutine) . IE8 ignores this and displays the image anyway.
    Is it possible to get a notification like Ignore/Abort/ Continue ???

    Does the documentation for that camera, or for the software with it, say anything about ActiveX or about H.264?
    If so, it isn't compatible with Firefox - it doesn't do ActiveX and it doesn't support H.264 in the HTML5 standard. Microsoft just released a plugin for Firefox that adds H.264 support to Firefox, but IIRC that only covers Windows 7 - not WinXP.

  • Adding image files to ApplicationController with initial letters "H"

    Hello.
    Whenever I add files (image, mostly png) with an initial letter of i or "bigger", they dont show up in the applicationController/ressources/images/... directory in the Application Navigator.
    Folders don't show up at all, and if there is a folder with a smaller letter than any image file, then all the following image files aren't shown.
    Weird bug i have to say..
    Kind regards,
    Pascal

    Pascal, what is your intent here? Are you going to use these images in a springboard or some other content? If so, they would go under the public_html folder on your drive which is visualized in JDev as your "Web Content" folder. If you place files or folders under the ApplicationController/src folder, they will show up under "Application Sources" in JDev.
    If you really want to include a specific folder as a resource, you can go to the project properties of the ApplicationController project, select "Project Source Paths", expand it and select "Resources". Then in the bottom section you can add a folder and it will then be included in your "Resources" of your ApplicationController project. I'm still not sure this is actually what you want though.
    I should note as well, I did not see or reproduce the problem you are seeing with filenames > H. Could you post exactly what you have in your directory structure on disk as well as what you see in JDev.
    Edited by: Denis T on Jul 26, 2012 9:00 AM

  • Load local image file to database on web

    Read_image_file works fine in client side. but it does not work on the web, can somebody find the way to save image from image file in client PC to Oracle database (or to webserver directory) when run on web.
    Thanks
    Frank
    null

    You may find the following articles useful for the JSP/Servlet part:
    Uploading files: http://balusc.blogspot.com/2007/11/multipartfilter.html
    Downloading files: http://balusc.blogspot.com/2007/07/fileservlet.html

  • How to read file in netbeans web project with relative path.

    Hi friends,
    I have created a web project in Netbeans with following stucture.
    Exercise1
    src --> database --> ConnectionManager.java
    cofig --> databaseproperties.xml
    I want to read config\databaseproperties.xml file in src\database\ConnectionManager.java file.
    I have tried to create a file input stream with path = "config" File.separator "databaseproperties.xml".
    I am getting error of File Not Found..
    Anybody has any idea? In Netbeans what is the default context path?
    Edited by: Jaykishan on Jun 29, 2010 11:54 AM

    place the *.jrxml files in your war (e.g. WEB-INF\classes\report.jrxml) and then in your servlet:
    JasperReport report = JasperCompileManager.compileReport("report.jrxml");

  • Query with relative paths

    I have a client who is fairly au fait with Dreamweaver but has run into some difficulties so they have asked me to take over.
    The problem files' (downloaded from the net into Dreamweaver using the 'get' function), relative paths were 'out' by an extra hierarchical level and hence didn't display or work correctly locally on my laptop. I haven't yet looked into why this was the case but was able to fix it without too much hassle by using the find and replace feature.
    However I am confused as to why these html pages display correctly online as their paths have an extra ../ in them.
    One of the pages that has the extra level is this http://www.wildlifeartgallery.com/exhibitions/harry_becker2/harry_becker2_page1.html
    The hierachy of the files in the website is as below with the scripts and styles folders on the same level as the index.html page. The problematic pages are located 'exhibitions/harry_becker2/harry_becker2_page1.html' to page7 (page 10 is me testing).
    Surely the relative links to the styles folder should be ../../ as they are with all the other artists' exhibition pages rather than ../../../ ??
    I would be most grateful if someone could take a look for me and give me an expIanation as to how the CSS and scripts display and work without issue when they seem to be linked incorrectly or is it me going mad!!
    Thanking you in anticipation.
    Lisa
    FYI I use Dreamweaver CS5.5 on OSx 10.6 and my clients use Dreamweaver CS6 on Mountain Lion.

    First thing I will tell you at the outset is that before you downloaded the site from the remote server, you should have defined a site on your laptop by creating the necessary folders for the site name, css, scripts, images, downloads, etc etc.  this would have put you in a better position and you would have avoided doing find & replace work.
    Now coming to your main question, the links in a website are either document relative or site relative.  The difference is that with site relative, you need to provide the full http:// address but with document relative, DW will put the links like this:
    <link href="css/main.css" rel="stylesheet" type="text/css">
    </head>
    As your site is now working, you will be better off keeping it as it is otherwise, you can read the first part of David's tutorial that teaches how to setup the basic site.  It doesn't go into creating folders for images, css, scripts etc but you get the idea after you have worked on his tutorial.
    <http://www.adobe.com/devnet/dreamweaver/articles/first_website_pt1_cs6.html>
    Good luck.

Maybe you are looking for