posted 12 years ago
Does anyone know why the following code would generate Postscript graphics instead of text?
I have a complex application, and I notice when I send something to a printer, the format of the content sent to the printer (via PrinterJob) is different depending on what code in my application has loaded in the JVM.
For example, if I run the below example code as a standalone and check the 'print to file' box in the print dialog, I can inspect the postscript produced. When running this simple code against different JVMs, the output is largely the same except for the time/date stamp.
<simple code>
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(new HelloWorldPrinter() /* Simple implementation of Printable */ );
boolean doPrint = job.printDialog();
try {
job.print();
} catch (PrinterException e) {
e.printStackTrace();
}
</simple code>
However, I have noticed that after certain code is loaded in my larger application the content of printed document output (from inspecting the output from the 'print to file' feature) is largely different - the content has clearly been printed to an image file.