You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Ocracoke <we...@aofw.org> on 2013/12/05 11:05:51 UTC
Batik PrintTranscoder throws a NullPointerException
Hello everyone!
I've been familiarising myself with Batik for converting data from the JGo
graphing libraries to a SVG document to print off using Batik but I've hit a
problem.
When I attempt to print off the SVGDcoument, the call to print fails. This
is the exception I get:
java.lang.NullPointerException
[2013-12-05 09:46:33,957] ERROR Netbase (Stream.java:175) [AWT-EventQueue-0]
: at java.awt.geom.AffineTransform.concatenate(AffineTransform.java:2232)
[2013-12-05 09:46:33,957] ERROR Netbase (Stream.java:175) [AWT-EventQueue-0]
: at sun.java2d.SunGraphics2D.transform(SunGraphics2D.java:1540)
[2013-12-05 09:46:33,957] ERROR Netbase (Stream.java:175) [AWT-EventQueue-0]
: at sun.print.PeekGraphics.transform(PeekGraphics.java:1654)
[2013-12-05 09:46:33,957] ERROR Netbase (Stream.java:175) [AWT-EventQueue-0]
: at org.apache.batik.transcoder.print.PrintTranscoder.print(Unknown
Source)
[2013-12-05 09:46:33,957] ERROR Netbase (Stream.java:175) [AWT-EventQueue-0]
: at sun.print.RasterPrinterJob.printPage(RasterPrinterJob.java:1973)
[2013-12-05 09:46:33,957] ERROR Netbase (Stream.java:175) [AWT-EventQueue-0]
: at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1461)
And this is the code I am using to get to this point:
PrintTranscoder transcoder = new PrintTranscoder();
transcoder = setupTranscoder(transcoder);
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(transcoder);
try {
job.setPrintService(settings.getPrintService());
PrintRequestAttributeSet set = new HashPrintRequestAttributeSet();
set.add(settings.getPaperSize());
job.print(set);
} catch (PrinterException e1) {
e1.printStackTrace();
}
[...]
private PrintTranscoder setupTranscoder(PrintTranscoder transcoder) {
TranscoderInput input = new TranscoderInput(document);
transcoder.transcode(input, null);
return transcoder;
}
--
View this message in context: http://batik.2283329.n4.nabble.com/Batik-PrintTranscoder-throws-a-NullPointerException-tp4655759.html
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: Batik PrintTranscoder throws a NullPointerException
Posted by Ocracoke <we...@aofw.org>.
I solved it. The document being passed into PrintTranscoder is null. Wouldn't
it make sense to have a not null check there?
--
View this message in context: http://batik.2283329.n4.nabble.com/Batik-PrintTranscoder-throws-a-NullPointerException-tp4655759p4655760.html
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org