Fonts PDF报告的iReport和Jasperreport字体

Fonts PDF报告的iReport和Jasperreport字体,fonts,jasper-reports,ireport,Fonts,Jasper Reports,Ireport,我用iReport制作了一份报告,使用了一些默认字体monospace,sans serif。 此报告有点复杂,许多静态元素的位置都经过计算以适合标签的宽度。 举个例子: 其中长字符串的测试。。。是一个字段内容,框是静态元素。 正如你所见,我需要一个精确的字符大小为 iReport预览效果很好,但当我使用JasperReport库制作报告时,字体大小与iReport预览完全不同,而且monospace字体根本不存在 如何准确创建类似ireport预览的PDF报告 这是JRXML头完整文件>200

我用iReport制作了一份报告,使用了一些默认字体monospace,sans serif。 此报告有点复杂,许多静态元素的位置都经过计算以适合标签的宽度。 举个例子: 其中长字符串的测试。。。是一个字段内容,框是静态元素。 正如你所见,我需要一个精确的字符大小为

iReport预览效果很好,但当我使用JasperReport库制作报告时,字体大小与iReport预览完全不同,而且monospace字体根本不存在

如何准确创建类似ireport预览的PDF报告

这是JRXML头完整文件>2000行:

<?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="107m" pageWidth="595" pageHeight="842" columnWidth="537" leftMargin="29" rightMargin="29" topMargin="20" bottomMargin="20" uuid="821aebb9-c4bd-4720-ae38-ae0f7e515398">
    <property name="ireport.zoom" value="1.4641000000000364"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="48"/>
    <property name="ireport.background.image" value="C:\v2(1).png"/>
    <property name="ireport.background.image.properties" value="true,true,0.25,1,-202,-7,184,612,865"/>
    <detail>
        <band height="801" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="0" width="536" height="18" uuid="07f24965-4a55-49f1-bbaa-c7550bc6b37f"/>
                <textElement textAlignment="Center">
                    <font size="11"/>
                </textElement>
                <text><![CDATA[TITLE]]></text>
            </staticText>
            <staticText>
                <reportElement x="0" y="14" width="536" height="18" uuid="06b42267-0de9-4467-96cb-aa477c3f07c1"/>
                <textElement textAlignment="Center">
                    <font size="9" isBold="true"/>
                </textElement>
                <text><![CDATA[SUBTITLE]]></text>
            </staticText>

要在pdf导出中获得与您使用的Jasper 6.0之前相同的字体

代码是这样的

<font fontName="Times New Roman" pdfFontName="Times-Roman" isPdfEmbedded="true"/>
由于Jasper6.0,这是不推荐的,您应该使用字体扩展

这对于如何在iReport中包含字体扩展非常有用


编辑:我在哪里可以在我的电脑上找到字体?在Windows上通常是C:\Windows\Fonts

您是否尝试在pdf中包含字体?传递相关的jrxml代码,至少您将使用相同的字体…我使用默认ireport字体:monospace和sansserif。它们存储在哪里?如何复制ireport过程?字体是否存储在.jasper编译文件中?我使用的不是Windows的字体,而是JVM或ireport?字体:Monospace和SansSerif。我只想在我的java应用程序中复制ireport的相同预览过程。pdf没有使用JVM字体。。。。你需要一个TrueType字体,这样你就可以将它添加为字体扩展名…如果你在pc上找不到它,搜索internet或切换字体。