Printing text in Java

A

Alexander Brown

Hello,

I am trying to find a way to print a multilined string using java.
I have tried using a class called DocumentRenderer which i found at
http://www.fawcette.com/javapro/2002_12/online/print_kgauthier_12_10_02/ but
my text keeps getting cut at the right hand edge of the page. On some lines
it does wrap, but always some of the text is missing. The article does
suggest that font measuring is faulty under windows and i guess maybe this
is what is happening here.

Can anyone help as to how to print a large string in a wrapped style? I
dont really have time to write the code from bare bones!

Thanks in advance,

Alex

p.s. if anyone has experience of the particular class i have mentioned then
this is the code i have used:
String myString = "A very long multilined string";
JEditorPane j = new JEditorPane("text/plain",myString);
DocumentRenderer d = new DocumentRenderer();
d.print(j);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,243
Latest member
Weeb3PRAgency

Latest Threads

Top