Results 1 to 5 of 5
  1. #1
    matpj is offline Member
    Join Date
    Sep 2008
    Posts
    42
    Rep Power
    0

    Default How to make Java see a string as html

    Hi all,

    this is my first post on the forum.
    I haven't actually started using Java yet, but went on a course a couple of weeks ago to start learning.
    A colleague of mine is having a bit of a problem with a pdf writer program he managed to find.
    He is implementing it in a WIKI that he is creating, and is having trouble making the pdfwrite see a string as html.
    it is creating the pdf as html code, NOT the 'results' of the code - if that makes sense.


    has anyone on here successfully implemented a pdf writer using Java. Or anything that takes html code and displays is as it should be.

    Thanks in advance,
    Matt

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,452
    Rep Power
    25

    Default

    There is an HTMLEditorKit that will format HTML when it is displayed in a JEditorPane.

  3. #3
    matpj is offline Member
    Join Date
    Sep 2008
    Posts
    42
    Rep Power
    0

    Default

    Thanks Norm.
    do you have any links for this kit and how to implement it?

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,452
    Rep Power
    25

    Default

    Its part of the JDK. I don't have any sample code, use a Search for it.
    I think the JEditorPane will look at added text and figure out what editor kit to use from that.

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    On JEditorPane you have to do few things first. Set the editor kit using setEditorKit() first, in that case you can use HTMLEditorKit. Then set the sontent type. To ge the content use getText(), and it return the content as a string of the JEditorPane.

Similar Threads

  1. Replies: 2
    Last Post: 09-18-2008, 07:30 AM
  2. how do i make a string return a number?
    By pjr5043 in forum New To Java
    Replies: 6
    Last Post: 09-15-2008, 04:56 AM
  3. Replies: 24
    Last Post: 07-29-2008, 04:04 PM
  4. Replies: 0
    Last Post: 11-20-2007, 04:59 PM
  5. make a variable name from a string?
    By Kinnikinnick in forum New To Java
    Replies: 3
    Last Post: 11-13-2007, 03:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •