0

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();
   }
3
  • You have the code, what is the problem? Commented Jul 10, 2013 at 11:09
  • it does not support html files with CSS Commented Jul 10, 2013 at 11:13
  • 1
    possible duplicate of take print from webview using javafx Commented Jul 10, 2013 at 15:49

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.