Hi, I have a problem printing in unix. The code I use works on Windows perfectly it also works on unix using another cups version but the margins are off. I have included the java file and the jrxml file. I have also incuded the cups version I'm using and the error I get.
My cups version is (printing does not work) cups-1.2.7-1.7.fc6 hal-cups-utils-0.6.5-1.fc6 cups-libs-1.2.7-1.7.fc6 libgnomecups-0.2.2-8 Other Cups version: cups-1.2.4-9 hal-cups-utils-0.6.2-4 cups-libs-1.2.4-9 libgnomecups-0.2.2-8 The cups error log I get when I print is as foll: I [01/Feb/2007:12:19:26 +0530] Adding start banner page "none" to job 121. I [01/Feb/2007:12:19:26 +0530] Adding end banner page "none" to job 121. I [01/Feb/2007:12:19:26 +0530] Job 121 queued on "Samsung" by "thomas". I [01/Feb/2007:12:19:26 +0530] Started filter /usr/lib/cups/filter/pstops (PID 10616) for job 121. I [01/Feb/2007:12:19:26 +0530] Started filter /usr/lib/cups/filter/foomatic-rip (PID 10617) for job 121. I [01/Feb/2007:12:19:26 +0530] Started backend /usr/lib/cups/backend/lpd (PID 10618) for job 121. E [01/Feb/2007:12:19:26 +0530] [Job 121] No %%BoundingBox: comment in header! E [01/Feb/2007:12:19:26 +0530] [Job 121] No %%Pages: comment in header! E [01/Feb/2007:12:19:27 +0530] [Job 121] /configurationerror in --setpagedevice-- My program is has 2 files PrintApp.java and myLabel.jrxml: PrintApp.java import java.io.InputStream; import java.util.HashMap; import java.util.Map; import javax.print.attribute.HashPrintRequestAttributeSet; import javax.print.attribute.HashPrintServiceAttributeSet; import javax.print.attribute.PrintRequestAttributeSet; import javax.print.attribute.PrintServiceAttributeSet; import javax.print.attribute.standard.Copies; import javax.print.attribute.standard.MediaSizeName; import javax.print.attribute.standard.PrinterName; import net.sf.jasperreports.engine.JREmptyDataSource; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRExporterParameter; import net.sf.jasperreports.engine.JasperCompileManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.export.JRPrintServiceExporter; import net.sf.jasperreports.engine.export.JRPrintServiceExporterParameter; public class PrintApp { public static void main(String[] args) throws Exception { PrintApp app = new PrintApp(); app.testPrinting(); } private void testPrinting() throws JRException { System.out.println("get report template"); InputStream templateAsStream = ClassLoader .getSystemResourceAsStream("myLabel.jrxml"); System.out.println("compile report"); JasperReport jasperReport = JasperCompileManager .compileReport(templateAsStream); // submit parameters Map parameters = new HashMap(); parameters.put("param1", "jasper report ..."); parameters.put("param2", "...rules"); System.out.println("fill the compiled template"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, new JREmptyDataSource()); // ------------------------------------------------------------------- // create the print service exporter so that we can print to a named printer JRPrintServiceExporter exporter = new JRPrintServiceExporter(); // set the report to print exporter.setParameter( JRPrintServiceExporterParameter.JASPER_PRINT, jasperPrint); // tell the exporter to print 1 copy on A4 paper PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); aset.add(new Copies(1)); aset.add(MediaSizeName.ISO_A4); exporter.setParameter( JRPrintServiceExporterParameter.PRINT_REQUEST_ATTRIBUTE_SET, aset); // let the exporter know which printer we want to print on PrintServiceAttributeSet serviceAttributeSet = new HashPrintServiceAttributeSet(); serviceAttributeSet.add(new PrinterName("Samsung", null)); exporter.setParameter( JRPrintServiceExporterParameter.PRINT_SERVICE_ATTRIBUTE_SET, serviceAttributeSet); // print it System.out.println("Started Printing"); exporter.exportReport(); System.out.println("Finished Printing"); } } ======================================================= myLabel.jrxml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"> <jasperReport name="myTestReport" pageWidth="289" pageHeight="241" columnWidth="277" leftMargin="6" rightMargin="6" topMargin="6" bottomMargin="6"> <parameter name="param1" class="java.lang.String"> </parameter> <parameter name="param2" class="java.lang.String"> </parameter> <pageHeader> <band height="227"> <textField> <reportElement positionType="Float" x="21" y="83" width="207" height="15"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[($P{param1})]]></textFieldExpression> </textField> <textField> <reportElement positionType="Float" x="125" y="191" width="105" height="15"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[($P{param2})]]></textFieldExpression> </textField> </band> </pageHeader> </jasperReport> ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ jasperreports-questions mailing list jasperreports-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jasperreports-questions