(I rewrite the original question. The problem is the same.)
The above example code do not print the image. It appears in the window but not printed.
public static void main(String[] args) {
final JEditorPane ed = new JEditorPane(
"text/html",
"<p>Test<br><img src='http://www.google.es/images/logos/ps_logo2.png'></p>");
JFrame f = new JFrame();
f.setLayout(new BorderLayout());
f.add(ed);
JButton b = new JButton("Print");
f.add(b,BorderLayout.SOUTH);
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
try {
ed.print();
} catch (PrinterException ex) {
System.err.println(ex);
}
}
});
f.pack();
f.setVisible(true);
}
Got this now. The “secret” is to intercept the image loading process and indicate that images should be loaded synchronously.