Czech example

Tags: fontsczechencodinglanguagesiText 7pdfCalligraphpdfCalligraph example

This example was originally written in answer to the question How to use Cyrillic characters in a PDF?. It was then used to create a series of other Font examples.

    This file is part of the iText (R) project.
    Copyright (c) 1998-2016 iText Group NV
 * Example written by Bruno Lowagie.
package com.itextpdf.samples.sandbox.fonts;
import com.itextpdf.kernel.font.PdfFont;
import com.itextpdf.kernel.font.PdfFontFactory;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.element.Paragraph;
import com.itextpdf.samples.GenericTest;
import com.itextpdf.test.annotations.type.SampleTest;
import org.junit.experimental.categories.Category;
public class CzechExample extends GenericTest {
    public static final String DEST = "./target/test/resources/sandbox/fonts/czech_example.pdf";
    public static final String FONT = "./src/test/resources/font/FreeSans.ttf";
    public static void main(String[] args) throws Exception {
        File file = new File(DEST);
        new CzechExample().manipulatePdf(DEST);
    protected void manipulatePdf(String dest) throws Exception {
        PdfDocument pdfDoc = new PdfDocument(new PdfWriter(DEST));
        Document doc = new Document(pdfDoc);
        PdfFont f1 = PdfFontFactory.createFont(FONT, "Cp1250", true);
        Paragraph p1 = new Paragraph("Testing of letters \u010c,\u0106,\u0160,\u017d,\u0110").setFont(f1);
        PdfFont f2 = PdfFontFactory.createFont(FONT, "Identity-H", true);
        Paragraph p2 = new Paragraph("Testing of letters \u010c,\u0106,\u0160,\u017d,\u0110").setFont(f2);
File nameRaw URLUpdated
CzechExample.javaCzechExample.java2016-08-12 4:51 pm
File nameRaw URLUpdated
FreeSans.ttfFreeSans.ttf2016-08-04 3:45 pm
File nameRaw URLUpdated
cmp_czech_example.pdfcmp_czech_example.pdf2016-08-12 4:54 pm