Example usage for com.lowagie.text.pdf BaseFont CP1257

List of usage examples for com.lowagie.text.pdf BaseFont CP1257

Introduction

In this page you can find the example usage for com.lowagie.text.pdf BaseFont CP1257.

Prototype

String CP1257

To view the source code for com.lowagie.text.pdf BaseFont CP1257.

Click Source Link

Document

A possible encoding.

Usage

From source file:lt.bsprendimai.ddesk.pdf.PDFTicket.java

License:Apache License

public byte[] writePage() throws Exception {
    ByteArrayOutputStream bout = new ByteArrayOutputStream();

    try {//from  www  . ja v  a  2s .  com
        logo = Image.getInstance(root.getAbsolutePath() + "/logo.gif");
        logo.setAlignment(Image.ALIGN_LEFT);
    } catch (Exception exc) {
        exc.printStackTrace();
    }

    baseArial = BaseFont.createFont(root.getAbsolutePath() + "/objects/arial.ttf", BaseFont.CP1257,
            BaseFont.EMBEDDED);

    Document doc = new Document(PageSize.A4, 56.5354331f, 22.6771654f, 28.3464567f, 25.0f);
    PdfWriter.getInstance(doc, bout);

    doc.open();

    logo.setAbsolutePosition(28.3464567f, doc.getPageSize().height() - logo.height() - 25.0f);
    doc.add(logo);
    Paragraph pg = new Paragraph(sdf.format(new Date()), new Font(baseArial, 10));
    pg.setAlignment(Element.ALIGN_RIGHT);
    doc.add(pg);
    doc.add(new Phrase("\n\n\n"));

    writeClientInfo(doc);
    writeTicketInfo(doc);
    writeJobInfo(doc);
    writeWorkerInfo(doc);

    doc.close();

    return bout.toByteArray();
}

From source file:org.opentestsystem.delivery.testreg.rest.view.PdfReportPageEventHelper.java

License:Open Source License

public PdfReportPageEventHelper(final PdfWriter writer) {
    template = writer.getDirectContent().createTemplate(100, 100);
    template.setBoundingBox(new Rectangle(-20, -20, 100, 100));
    try {//from  w  ww.ja  va2s . c  om
        helv = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.CP1257, BaseFont.NOT_EMBEDDED);
    } catch (Exception e) {
        throw new ExceptionConverter(e);
    }
}

From source file:uk.org.rbc1b.roms.controller.volunteer.VolunteerBadgePdfView.java

License:Open Source License

/**
 * Adds the Volunteer's name to the Badge.
 *
 * @param content to be added// w ww. jav  a 2 s.c o  m
 * @param name concatenated String of forename and surname
 */
private static void addVolunteerName(PdfContentByte content, String name)
        throws DocumentException, IOException {
    content.beginText();
    content.moveText(183, 470);

    BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1257, false);
    content.setFontAndSize(bf, 16);
    content.setColorFill(Color.BLACK);
    content.showText(name);
    content.endText();
}

From source file:uk.org.rbc1b.roms.controller.volunteer.VolunteerBadgePdfView.java

License:Open Source License

/**
 * Adds a department to the Badge. The badge only shows the first
 * departmental assignment of a Volunteer, not all their departmental
 * assignments./*from ww w. j  a  v  a 2s . c  o m*/
 *
 * @param content to be added
 * @param department of the volunteer
 */
private static void addDepartment(PdfContentByte content, String department)
        throws DocumentException, IOException {
    content.beginText();
    content.moveText(183, 453);

    BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1257, false);
    content.setFontAndSize(bf, 14);
    content.showText(department);
    content.endText();
}