2
A
回答
1
看一看這個example:
Document document = new Document(PageSize.A4);
String filename = ""; // Set the relative path and name for the output file
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(filename));
document.open();
// Fix the path to the font if needed
BaseFont bf = BaseFont.createFont("c:/windows/fonts/arial.ttf", BaseFont.IDENTITY_H, true);
Font font = new Font(bf, 14);
ColumnText column = new ColumnText(writer.getDirectContent());
column.setSimpleColumn(36, 770, 569, 36);
column.setRunDirection(PdfWriter.RUN_DIRECTION_RTL);
String text = "הטקסט שלך בעברית"; // Your text in hebrew
column.addElement(new Paragraph(text, font));
column.go();
document.close();
+0
我有你的代碼的一些錯誤,這工作column.RunDirection = PdfWriter.RUN_DIRECTION_RTL; String text =「הטקסטשלךבעברית」; //你的希伯來語文字 column.AddElement(new Paragraph(text,Gisha)); column.Go(); – Harry
0
我做了一些簡單的函數來處理這個問題。它只是將文本翻轉到另一邊,並將其作爲可添加到文檔中的短語返回。 與列的問題是,您需要準確的信息,你要寫的地方。另外我建議使用PdfContentByte在更精確的地方寫。
public Phrase makingPhrases(string toPhrase, bool toReverse,int SF)
{
BaseFont unicode = BaseFont.CreateFont(Server.MapPath("font/mriam.ttf"), BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Font bold = new Font(unicode, SF);
if (toReverse)
return new Phrase(revertText(toPhrase), bold);
else
return new Phrase(toPhrase, bold);
}
public string revertText(string revertTo)
{
string toret = "";
for (int i = 0; i < revertTo.Length; i++)
{
toret += revertTo[revertTo.Length - i - 1];
}
return toret.ToString();
}
相關問題
- 1. 在pdf上書寫和顯示希伯來字母
- 2. php |反向希伯來語字符串,但沒有反向英文字母
- 3. 希伯來文字母的PHP範圍
- 4. 希伯來語和數字
- 5. 希伯來語字符串希伯來語
- 6. 如果用希伯來字母比較
- 7. 如果用希伯來字母條件
- 8. 希伯來語多語言[數字]
- 9. 用希伯來文和英文字母排列的文件名
- 10. 希伯來語有序列表字母反轉
- 11. 需要顯示「希伯來語」字符
- 12. 字符串轉換爲希伯來語
- 13. NG模式只希伯來語字符
- 14. 轉換希伯來字符以英語
- 15. 希伯來語文本PDF
- 16. 顯示反向數字時,Android的加載希伯來語rss ...
- 17. Python中的Ghematria:希伯來字母數字和總和
- 18. 檢測字符串中的希伯來字母
- 19. java itext使用希伯來語(rtl)和英語創建pdf
- 20. 用希伯來語
- 21. NavigateUrl裏面的希伯來文字
- 22. 文本文件問題中的希伯來語字段
- 23. 如何在Django SlugField寫希伯來語
- 24. 在html中使用希伯來語的字體對齊方式
- 25. 比較兩個字符串希伯來語按字母順序排列
- 26. 將希伯來字母轉換成等效數字
- 27. PHP麻煩轉換編碼希伯來語(ISO-8891-8-I)字符串返回到希伯來文字符
- 28. 發佈希伯來語+英文文字,詞弄混
- 29. PHP希伯來文字符數
- 30. 獲取希伯來文字體大綱
的可能重複的[java的iText的創建與希伯來語(RTL)PDF和英文](http://stackoverflow.com/questions/5855078/java-itext-create-pdf-with-hebrew-rtl-and -english) –
你是否從html或「手動」創建pdf? – iddqd
@iddqd「手動」 –