Printed out SVG document looks as it should, currently haven't noticed any issues. This is definitely a good sign.
Here is a java code that works for me.
public void actionPerformed(ActionEvent e) {
PrinterJob printerJob = PrinterJob.getPrinterJob();
PageFormat pageFormat = printerJob.defaultPage();
PrintTranscoder transcoder = new PrintTranscoder();
TranscoderInput ti = new TranscoderInput(svgCanvas.getSVGDocument());
transcoder.transcode(ti, null);
if (printerJob.pageDialog(pageFormat) != pageFormat) {
if (printerJob.printDialog()) {
printerJob.setPrintable(transcoder);
try {
printerJob.print();
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
} else {
System.err.println("Print was cancelled");
}
}
No comments:
Post a Comment