0
我创建了一个碧玉报告(发票)文件并通过JButton
运行它。当我点击按钮时,它会按预期显示预览,但是当我点击Jasper Viewer中的打印按钮以使用点阵打印机(TVS 240 star)进行打印时,页面上的字体(硬拷贝)彼此重叠并且大小也发生了变化。Jasper报告字体在点阵打印机打印时重叠
我该如何解决这个问题?
(页面大小5英寸宽6英寸高度/ Arial字体的Unicode MS,9)
public void bill(){
if(textField_10.getText().equals(""))
{
JOptionPane.showMessageDialog(null,"Enter Bill no. !","Invoice", getDefaultCloseOperation());
textField_10.grabFocus();
}
else{
try{
String para=textField_7.getText();
String para1=textField_8.getText();
String para2=textField_9.getText();
String para3=textField_10.getText();
String sourceName="/DBcon/new.jrxml";
//String sourceName="/DBcon/Invoice.jrxml";
java.io.InputStream in=null;
HashMap<String, Object> hm=new HashMap<String,Object>();
hm.put("Retailer_Name",para); //jasper report parameter passing
hm.put("Address",para1);
hm.put("Contact",para2);
hm.put("Billno",para3);
in=getClass().getResourceAsStream(sourceName);
JasperReport jr=JasperCompileManager.compileReport(in);
JasperPrint jp=JasperFillManager.fillReport(jr,hm,con);
JasperViewer.viewReport(jp,false);
// JasperPrintManager.printReport(jp,true);
//JasperExportManager.exportReportToPdfFile(jp, destinationFile);
Exporter exp = new JRDocxExporter();
exp.setExporterInput(new SimpleExporterInput(jp));
File exportReportFile = new File("C:\\Users\\Public\\Documents\\invoice.docx");
exp.setExporterOutput(new SimpleOutputStreamExporterOutput(exportReportFile));
exp.exportReport();
}
catch(Exception e){
e.printStackTrace();
JOptionPane.showMessageDialog(null,"Close previous invoice");
}
}
}
蹊跷* JRXML *(报告的模板) –