Problem printing on a shared printer

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
ununes
Posts: 1
Joined: Tue May 04, 2010 8:34 pm
antibot: No, of course not.

Problem printing on a shared printer

Post by ununes » Tue May 04, 2010 8:40 pm

I have the following function to print a Chart, but it doesn´t work on a SHARED printer, only on network printers.

Code: Select all

/**
	 * This method plot a chart on a Panel.
	 * @author Ulisses Nunes
	 * 
	 * @param JPanel - Painel to print the chart.	 
	*/ 
	public void print (JPanel painelGrafico) {		
		PrinterJob job = PrinterJob.getPrinterJob();		
        PageFormat pf  = job.defaultPage();
        PageFormat pf2 = job.pageDialog(pf);
        
        if (pf2 != pf) {        	
            job.setPrintable((Printable)painelGrafico, pf2);
            if (job.printDialog()) {
                try {
                    job.print();
                }
                catch (PrinterException e) {
                    JOptionPane.showMessageDialog(painelGrafico, e);
                }
            }
        }
 	}
When I choose PRINT on JFreeChart menu the default shared printer receive a 64MB file and an error appears. How can I solve this one? Help please.

Locked