iText 7 pdfCalligraph
pdfCalligraphは、JavaとC#(.NET) 用のiText 7アドオンで、PDFの高度な活版印刷機能のロックを解除することができます。同様に、正確な レンダリングを組み込んで、データ処理に最適なグローバル言語及びライティングシステムでドキュメントワークフローを拡張することも可能です。
Supported Scripts
Language | Script | Module |
Arabic, Persian, Kurdish, Azerbaijani, Sindhi, Pashto, Lurish, Urdu, Mandinka, Punjabi and others | ARABIC | pdfCalligraph |
Hebrew, Yiddish, Judaeo-Spanish, and Judeo-Arabic | HEBREW | pdfCalligraph |
Bengali | BENGALI | pdfCalligraph |
Hindi, Sanskrit, Pali, Awadhi, Bhojpuri, Braj Bhasha, Chhattisgarhi, Haryanvi, Magahi, Nagpuri, Rajasthani, Bhili, Dogri, Marathi, Nepali, Maithili, Kashmiri, Konkani, Sindhi, Bodo, Nepalbhasa, Mundari and Santali | DEVANAGARI, NAGARI | pdfCalligraph |
Gujarati and Kutchi | GUJARATI | pdfCalligraph |
Punjabi | GURMUKHI | pdfCalligraph |
Kannada, Konkani and others | KANNADA | pdfCalligraph |
Khmer (Cambodia) | KHMER | pdfCalligraph |
Malayalam | MALAYALAM | pdfCalligraph |
Odia | ORIYA | pdfCalligraph |
Tamil | TAMIL | pdfCalligraph |
Telugu (Dravidian language) | TELUGU | pdfCalligraph |
Thai | THAI | pdfCalligraph |
Chinese | Core | |
Japanese | Core | |
Korean | Core | |
WESTERN | Core | |
Russian, Ukrainian, Belarussian, Bulgarian and others | CYRILLIC | Core |
Greek | GREEK | Core |
Armenian | ARMENIAN | Core |
Georgian | GEORGIAN | Core |
How it works
For this example, we'll demonstrate using pdfCalligraph to correctly render text in different languages. First, let’s start with a simple English sentence, which we've translated into three different languages using Google Translate.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
final String[] sources = {"english.xml", "arabic.xml", "hindi.xml", "tamil.xml"};
final PdfWriter writer = new PdfWriter(DEST);
final PdfDocument pdfDocument = new PdfDocument(writer);
final Document document = new Document(pdfDocument);
final FontSet set = new FontSet();
set.addFont("fonts/NotoNaskhArabic-Regular.ttf");
set.addFont("fonts/NotoSansTamil-Regular.ttf");
set.addFont("fonts/FreeSans.ttf");
document.setFontProvider(new FontProvider(set));
document.setProperty(Property.FONT, new String[]{"MyFontFamilyName"});
for (final String source : sources) {
final File xmlFile = new File(source);
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
final DocumentBuilder builder = factory.newDocumentBuilder();
final org.w3c.dom.Document doc = builder.parse(xmlFile);
final Node element = doc.getElementsByTagName("text").item(0);
final Paragraph paragraph = new Paragraph();
final Node textDirectionElement = element.getAttributes().getNamedItem("direction");
boolean rtl = textDirectionElement != null && textDirectionElement.getTextContent()
.equalsIgnoreCase("rtl");
if (rtl) {
paragraph.setTextAlignment(TextAlignment.RIGHT);
}
paragraph.add(element.getTextContent());
document.add(paragraph);
}
document.close();
pdfDocument.close();
writer.close();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
string[] sources = new string[] { "english.xml", "arabic.xml", "hindi.xml", "tamil.xml" };
PdfWriter writer = new PdfWriter(DEST);
PdfDocument pdfDocument = new PdfDocument(writer);
Document document = new Document(pdfDocument);
FontSet set = new FontSet();
set.AddFont("NotoNaskhArabic-Regular.ttf");
set.AddFont("NotoSansTamil-Regular.ttf");
set.AddFont("FreeSans.ttf");
document.SetFontProvider(new FontProvider(set));
document.SetProperty(Property.FONT, new String[] { "MyFontFamilyName" });
foreach (string source in sources)
{
XmlDocument doc = new XmlDocument();
var stream = new FileStream(source, FileMode.Open);
doc.Load(stream);
XmlNode element = doc.GetElementsByTagName("text").Item(0);
Paragraph paragraph = new Paragraph();
XmlNode textDirectionElement = element.Attributes.GetNamedItem("direction");
Boolean rtl = textDirectionElement != null && textDirectionElement.InnerText.Equals("rtl");
if (rtl)
{
paragraph.SetTextAlignment(TextAlignment.RIGHT);
}
paragraph.Add(element.InnerText);
document.Add(paragraph);
}
document.Close();
Input
Output
リソース
pdf2Calligraphのインストールと使用に必要なリソースがここにあります。
Other resources
iText 7 pdfCalligraphのコア機能
既製PDFクリエーターは、アラビア語、ヘブライ語、ヒンディー語、タイ語などの文字の相互作用や書記体系、およびカーニング、合字、そしてグリフの代用に関して問題を抱えています。pdfCalligraphはこれらすべての書記体系を簡単に処理して、OpenType機能を 利用することによって、言語と書記体系においてiText PDF機能の全範囲を開示します。これには、複合文字を含む書記体系のテキスト抽出も含まれています。pdfCalligraphのもう1つの利点は、Javaもしくは.NET(C#)でプログラミングの調整を行う必要がないことです。
高度なフォント機能を活用
OpenType機能、カーニング、合字やグリフの代替などが使えます。
透明性のあるサポートは多言語に対応
ブラーフミー系文字、アラビア語、ヘブライ語のスクリプトを使っている言語を含みます。
言語や筆記体系を自動検出
必要なフォント機能が有効になり、自動的に適用されます。手動設定が可能です。pdfCalligraphは、iText 7 CoreおよびpdfHTMLとシームレスに統合します。
あらゆる筆記体系のタイポグラフィを調整
左寄せ、右寄せ、中央揃え、両端揃えができます。
iText 7 pdfCalligraphを使う理由
pdfCalligraphは可能性の世界を開いて、あらゆる場所のビジネスにサービスの提供ができるようにします。pdfcalligraphは、顧客の所在地やビジネス拠点がどこであっても、PDF言語機能のあらゆる機能を、現地の言語と書記体系で提供します。
国際事業のサポート
PDFのプログラミングを調整することなく、多言語向けの文書処理を使用することができます。多文化ユーザー間で独自仕様ではないデータ形式をやり取りできます。さまざまな書記体系でPDF文書を大量に作成できます。
特殊言語を持つPDFへの巧妙な変換
カンナダ語、 アラビア語、タミル語など、複数の言語にある特殊なフォントや文字をPDFで 利用できます。
PDFにある書記体系の自動検出
PDF作成時に使用されている書記体系を検出します。 スクリプト 固有の情報やフォント固有の情報に基づいてグリフの置換を行います。右から左へと読むアラビア語などは、読み順に関する情報を追加します。