- Chinese cannot be displayed
Settings: in properties, as follows
Font name: Arial
Pdf font name ...: STSong-Light
Pdf Embedded: Check (optional)
Pdf Encoding:UniGB-UCS2-H (Chinese Simplified)
iTextAsian.jar和iTextAsianCmaps.jar
Tip: Import iTextAsian.jar into the classpath of ireport (Tools-->Options-->iReport:Classpath )
iTextAsian.jar download link:
https://pan.baidu.com/s/1jJmefVS Password: drjl
- Use extra fonts
There are fonts ireport other than Arial, such as bold, etc., but they cannot be displayed in pdf. Only STSong-Light is available under Pdf font name ..., and effects such as bold and italics are invalid in pdf. Therefore, if you want to use fonts other than Arial, you need to do the following settings: (Take bold simhei.ttf as an example)
1) Method 1
Step 1: Copy the font to be used under ...\ireport\font;
如:D:\Program Files (x86)\Jaspersoft\iReport-5.6.0\ireport\fonts\simhei.ttf
Step 2: Import the font in step 1 into the classpath of ireport, that is, Tools --> Options --> iReport: Classpath
Note: The import file must go to the parent directory of the font ttf.
Step 3: Introduce the font imported in step 2 into the font of ireport, that is, Tools --> Options --> iReport: Fonts
Step 4: Restart ireport, then make the following settings
Pdf font name ...: bold (simhei.ttf)
Pdf Embedded: Check (optional)
Pdf Encoding:Identity-H (Unicode with horizontal writing)
2) Method 2
Tools-->Options-->iReport:fonts-->Install Font
Select the font file to be installed to import, and perform related operations and settings. For example, the font name is set to "bold 0" and so on.
After the installation is complete, you can see the newly installed font name in Font Name.
At this time, the settings of step 4 in method 1 can be ignored, just set the Font Name, and the relevant bolding will also take effect.
- When Jasperreport generates a report, it cannot find the corresponding font and throws an exception
1) Method 1
Step 1: Copy the font file under ireport, that is, the new font folder, to the project root directory;
Step 2: Right-click on your project-->Build Path-->Configure Build Path-->Libraries option, select "Add Class Folder", select the font file just copied to the root directory, and click OK.
Note: The import file must go to the parent directory of the font ttf.
2) Method 2
Step 1: Create a new empty project and put the font (such as: simhei.ttf) under the SRC (remember not to build the package in the SRC but put it directly).
Step 2: Package the project in Step 1 into a jar and import it into the lib of the project to export pdf.
3) Method 3
Put the font in the SRC of the project where the pdf is to be exported (be careful not to put it under a package, but directly under the SRC).
4) Method 4
Package the font installed by ireport (that is, the second method in 2) into a jar, and drop it directly into the lib of the project to export the pdf.
ireport FAQ Summary
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=325208096&siteId=291194637
Ranking