JRXML印地文文本到PDF

时间:2017-06-08 06:53:08

标签: java jasper-reports export-to-pdf

我有这个#define DDRA (*((volatile unsigned char *)0x3A)) #define PORTA (*((volatile unsigned char *)0x3B)) #define PINA (*((volatile unsigned char *)0x39)) #define LED_BIT 0 #define BTN_BIT 1 int main(void) { DDRA = (1 << LED_BIT); // PA0 output PORTA = (1 << BTN_BIT); // enable internal pull up on PA1 while (1) { if (!(PINA & (1 << BTN_BIT))) { // button pressed PORTA |= (1 << LED_BIT); // turn led on } } } 文件:

.jrxml

当我将其转换为PDF时,我没有得到印地文文本。我转换为pdf的代码如下:

 <?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="multi1" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c8a053f6-858e-427b-aec1-89231aadddd6">
<title>
    <band height="79" splitType="Stretch">
        <staticText>
            <reportElement x="104" y="0" width="313" height="25" uuid="fa5e3e6e-26f7-4973-a2d5-3c3b7a5e8227"/>
            <textElement textAlignment="Center">
                <font size="16" fontName="Lohit Devanagari" isPdfEmbedded="true" pdfEncoding="Identity-H" />
            </textElement>
            <text><![CDATA[अतिदेय राशि के पुनर्भुगतान हेतु अनुस्मारक]]></text>
        </staticText>
        <staticText>
            <reportElement x="132" y="25" width="252" height="25" uuid="fa5e3e6e-26f7-4973-a2d5-3c3b7a5e8227"/>
            <textElement textAlignment="Center">
                <font size="16"/>
            </textElement>
            <text><![CDATA[Reminder for repaying Overdue Amount]]></text>
        </staticText>
    </band>
</title>
</jasperReport>

我该如何解决这个问题?我尝试从JasperSoft Studio创建一个带有public class PdfFromXmlFile { public static void main(String[] args) throws JRException, IOException { // Compile jrxml file. JasperReport jasperReport = JasperCompileManager .compileReport("C:/report.jrxml"); // Parameters for report Map<String, Object> parameters = new HashMap<String, Object>(); // DataSource // This is simple example, no database. // then using empty datasource. JRDataSource dataSource = new JREmptyDataSource(); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, dataSource); // Make sure the output directory exists. File outDir = new File("C:/jasperoutput"); outDir.mkdirs(); // Export to PDF. JasperExportManager.exportReportToPdfFile(jasperPrint, "C:/jasperoutput/report.pdf"); System.out.println("Done!"); } } ttf的jar并将其导入到此处,但它不起作用。

0 个答案:

没有答案
相关问题