Reputation: 1727
I am creating a html file using java program . HTML file is using CSS
also . I am opening this file using javafx webview. Is it possible to send this html file to print command using java
I am doing this by opening the file in JEditorPane
and then print the jeditorpane
.
For Printing through JEditorPane
,I am using the following code.
try
{
File HtmlFile= new File("path of file");
JEditorPane htmlPane= new JEditorPane();
htmlPane.setPage(htmlFile.toString());
htmlPane.print();
}
catch(Exception ex)
{
ex.printStackTrace();
}
Upvotes: 0
Views: 1712
Reputation: 4239
JEditorPane
does not support the full CSS
specification.
The only advice I can offer is to look at alternative HTML/CSS renders for Java. One that I can recommend is the xhtmlrenderer project. Development has slowed down of late, but nevertheless, it can serve your purpose
Upvotes: 1