我正在使用iText v5
in ColdFusion 9並希望包含CopyRight
符號。文檔和書籍說通過unicode
字符串,例如\u00a9
。我回來的是字符串,而不是符號。這是我的測試用例:iText v5 unicode和ColdFusion
// Ask iText what version it is. This include the Registered and Copyright symbols so this
// font can obviously display them
vers = variables.javaLoader.create("com.itextpdf.text.Version").getVersion();
// Make a new paragraph and add the version number to the document
vPara = variables.javaLoader.create("com.itextpdf.text.Paragraph").init(vers);
myDoc1.add(vPara);
// Make a new string including the CopyRight symbol as per the iText docs and book
str = CreateObject("java","java.lang.String").init('Acme Products\u00a9');
// Make another paragraph and add the string to the document
para = variables.javaLoader.create("com.itextpdf.text.Paragraph").init(str);
myDoc1.add(para);
這就是輸出(拷貝FOM的PDF):
iText® 5.4.1 ©2000-2012 1T3XT BVBA
Acme Products\u00a9
通知的已註冊和版權符號正確地顯示在版本字符串所以字體可顯示他們。
我想我錯過了一些真正基本的東西,但不能看到它。我知道我並不需要創建自己的java.lang.String
,因爲這正是CF所做的,但是爲了消除這種可能性,我走了那麼遠。
會發生什麼,如果你只是做'海峽=的CreateObject( 「Java」 的, 「java.lang.String中」)的init( 'Acme的Products®');' – duncan