Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / August 2006

Tip: Looking for answers? Try searching our database.

HTML Printing from JEditorPane

Thread view: 
mtp - 23 Aug 2006 15:04 GMT
Hello,

i need to be able to print HTML. Right now, i'm using a JEditorPane with
a modified version of this:

PrintUtilities class
http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-Printing.html

but the problem is that page breaks happens in middle of image or text
line. So i must find a better way. I've found these:

Start of a complete formatting framework, too much things to
add/correct/understand:
http://www.javaworld.com/javaworld/jw-10-2000/jw-1020-print.html

Some tools to show/print HTML, in last resort
http://mindprod.com/jgloss/htmlrendering.html

Is there any simple way to correct the page break problem?

TIA
Thomas Weidenfeller - 23 Aug 2006 16:41 GMT
> Is there any simple way to correct the page break problem?

No, there isn't. You would need to obtain or write an HTML renderer
which does proper pagination. The problem with HTML is that it doesn't
provide hints about where page breaks should be, since HTML has the
notation of a single page only. Any renderer therefore has to guess. And
has to overcome obstacles like very wide lines, since there is no
horizontal scrollbar on a printed page ;-)

Further, you will have some fun with Java's printing system which can
drive people insane.

You could try if you could make Apache FOP work for you
http://xmlgraphics.apache.org/fop/ However, they also recommend not to
start with HTML.

/Thomas
Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.