I have code that should print content of my JTextPane control, but nothing prints on page. Page is blank. Here is my code:
@Override
public void actionPerformed(ActionEvent arg0) {
// kod za printanje sadrzaja iz JTextPane-a
/*
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(new Editor());
boolean ok = job.printDialog();
if(ok){
try{
job.print();
}
catch(PrinterException pex){
JOptionPane.showMessageDialog(new Editor(), "Greška pri printanju dokumenta!", "Poruka", JOptionPane.INFORMATION_MESSAGE);
}
*/
try{
//System.out.println(tekst1.getText());
// PrintRequestAttributeSet attr_set = new HashPrintRequestAttributeSet();
// attr_set.add(MediaSizeName.ISO_A4);
tekst1.setContentType("text/html");
tekst1.print();
}
catch(Exception pex){
pex.printStackTrace();
}
}
};
Could anyone help me!?