我正在使用Thymeleaf和Spring启动,我使用ITextRenderer从Thymeleaf模板生成PDF文件,我有一些Unicode(HEX)值来显示货币符号,但它不会呈现Unicode字符
我从此网址Currency Unicode reference
获取了货币符号Unicode以下是我从Thymeleaf模板生成PDF的Java代码
String html = templateEngine.process("templates/Quote", context);
FileOutputStream os = null;
File parentDirectory=null;
try {
OutputStream outputStream = new FileOutputStream(quoteNumber+".pdf");
BufferedOutputStream bs= new BufferedOutputStream(outputStream);
ITextRenderer renderer = new ITextRenderer();
renderer.setDocumentFromString(html);
renderer.layout();
renderer.createPDF(bs,true);
outputStream.close();
Assert.notNull("greeting", "The templateName can not be null");
final Context ctx = new Context();
String processedHtml = templateEngine.process("greeting", ctx);
String fileName = UUID.randomUUID().toString();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
//e.printStackTrace();
log.error("File not found >>> ",e);
} catch (IOException e) {
// TODO Auto-generated catch block
//e.printStackTrace();
log.error("IO Exception >>> ",e);
}
finally {
if (os != null) {
try {
os.close();
} catch (IOException e) { /*ignore*/ }
}
}
请帮我在生成的PDF中显示货币符号