• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to print the contents of jtextpane.

 
narasimharao konjeti
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
I have one query on JTextPane, in my program, i am using JTextPane to display the html content(html editor kit installed, some images is also there). We are able to display html code correctly on JTextPane. But when i am trying to print content in JTextPane, my print page is showing "Html" content(html code), instead of printing html display .how do i resolve this problem, if there is any please send the code.
thanks in advance.
cheers
nr konjeti
 
VIJAY Yadlapati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this code
....
....
textPane.setSelectionStart(0);
textPane.setSelectionEnd(textPane.getText().length());
This will select the Text in the TextPane.
Then use textPane.getSelectedText() to get the visible text, and print it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic