ireports内部预览& pdf预览 [英] difference between ireports Internal preview & pdf preview

查看:580
本文介绍了ireports内部预览& pdf预览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Jaspersoft iRreport Designer 4.0.2中设计了报告

I have designed the reports in Jaspersoft iRreport Designer 4.0.2

在内部预览中,它以指定的字体(calibri)显示报告。它的设计和元素对齐是恰当的。
但是在PDF预览中它的字体,元素的对齐方式是不同的。

In Internal preview it shows the report in specified font(calibri). Its design and alignment of elements is proper. But in PDF preview its font,alignment of elements are different.

推荐答案


  • 试试设置 pdfFontName isPdfEmbedded 字体设置。

    • Try to set pdfFontName and isPdfEmbedded font settings.
    • 样本:

      <font fontName="Arial" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
      

      PDF embedded 标志指定是否外部TrueType字体文件应包含在 PDF 文件中的

      The PDF embedded flag specifies whether an external TrueType font file should be included in the PDF file.


      • 另一种方法是使用字体扩展机制。供应商推荐使用此方法。

      • Another way is to use the Font Extensions mechanism. This method is recommended by vendor.

      示例:

      您可以使用 iReport 生成 Calibri 字体的字体扩展名。结果将是 jar 文件。

      You can generate the font extension for Calibri font with iReport. The result will be the jar file.

      配置文件(来自生成的jar包)将是:

      The config file (from the generated jar package) will be:

      <?xml version="1.0" encoding="UTF-8"?>
      <fontFamilies>
         <fontFamily name="Calibri">
             <normal><![CDATA[fonts/calibri.ttf]]></normal>
             <bold><![CDATA[fonts/calibrib.ttf]]></bold>
             <italic><![CDATA[fonts/calibrii.ttf]]></italic>
             <boldItalic><![CDATA[fonts/calibriz.ttf]]></boldItalic>
             <pdfEncoding><![CDATA[Identity-H]]></pdfEncoding>
             <pdfEmbedded><![CDATA[true]]></pdfEmbedded>
             <exportFonts>
                     <export key="net.sf.jasperreports.html"><![CDATA[CalibriHtml]]></export>
             </exportFonts>
             <locales>
                     <locale><![CDATA[en]]></locale>
             </locales>
         </fontFamily>
      </fontFamilies>
      

      来自 jrxml 文件的片段,用于演示新字体扩展名的使用情况:

      The snippet from jrxml file for demonstrating the usage of a new font extension:

      <staticText>
          <reportElement x="215" y="26" width="100" height="20"/>
          <textElement>
              <font fontName="Calibri"/>
          </textElement>
          <text><![CDATA[Static text]]></text>
      </staticText>
      

      您可以使用此链接,了解有关在 JasperReports 中使用字体的详细信息。

      You can use this link for detailed information about using fonts in JasperReports.

      这篇关于ireports内部预览&amp; pdf预览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆