【发布时间】:2019-05-29 01:24:50
【问题描述】:
我正在尝试几种不同的方法,但我无法获得使用 Flying Saucer 生成的 pdf(来自 html 文件)来显示印度卢比的 unicode 字符 -“₹”
这是我目前拥有的:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style>
body {
font-family: Arial Unicode MS, Lucida Sans Unicode, Arial, verdana, arial, helvetica, sans-serif;
}
@font-face {
font-family: 'Arial Unicode MS';
src: url(arialunicodems.ttf);
-fs-pdf-font-embed: embed;
-fs-pdf-font-encoding: UTF-8;
-fs-pdf-font-encoding: Identity-H;
font-weight: normal;
}
</style>
</head>
<body>
<p>We want to see a Indian Rupees symbol between the asterisks on one or more of these lines, in the PDF (if any of the symbols make it through to the PDF then we're good):</p>
<p>Using the glyph itself in the markup: * ₹ *</p>
<p>Using &#x20B9; in the markup: * ₹ *</p>
<p>Using &#8377; in the markup: * ₹ *</p>
</body>
</html>
这代表了许多不同的实验,但都没有奏效。它所指的字体文件位于上述 html 文件版本的旁边。
字体本身似乎正在加载,因为 pdf 文件中的文本看起来像 Arial。它只是缺少卢比符号。我不知道还能做什么 - 我正在使用 unicode 字体,并且在浏览器中查看时,html 文件本身看起来很好。当我用 chrome 打印出来时,它看起来也很好,所以我认为问题肯定出在飞碟上。
我使用飞碟如下:
/usr/bin/java -Djava.awt.headless=true -cp .:$FS_PATH/acts_as_flying_saucer/lib/java/bin:$FS_PATH/acts_as_flying_saucer/lib/java/jar/minium.jar:$FS_PATH/acts_as_flying_saucer/lib/java/jar/itext-paulo-155.jar:$FS_PATH/acts_as_flying_saucer/lib/java/jar/core-renderer.jar:$FS_PATH/acts_as_flying_saucer/lib/java/jar/java-getopt-1.0.13.jar Xhtml2Pdf /home/max/font_test.html /home/max/font_test.pdf
谁能看看我做错了什么?
【问题讨论】:
标签: pdf unicode utf-8 flying-saucer