Example usage for com.itextpdf.text Font ITALIC

List of usage examples for com.itextpdf.text Font ITALIC

Introduction

In this page you can find the example usage for com.itextpdf.text Font ITALIC.

Prototype

int ITALIC

To view the source code for com.itextpdf.text Font ITALIC.

Click Source Link

Document

this is a possible style.

Usage

From source file:Tables.PrinterClass.java

public PrinterClass() {
    /****default values for the printer */
    System.out.println("instantiating the printer class");

    companyName = "Unity Systems";
    companyLocation = "Malingo, HIAMS building, Buea";
    companyTel = "+237 679574561";
    companyPoBox = "PB 1001, Buea";

    smallFooter = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.ITALIC, new BaseColor(157, 175, 157));
    this.companyNameFont = new Font(Font.FontFamily.TIMES_ROMAN, 22, Font.BOLD, new BaseColor(0, 0, 128));
    this.companySubInfoFont = new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD, new BaseColor(51, 102, 13));
    this.tHeadingFont = new Font(Font.FontFamily.TIMES_ROMAN, 16, Font.BOLD, new BaseColor(51, 51, 0));
    this.tBodyFont = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD, new BaseColor(51, 51, 51));

    this.saveDir = "\\";

    dateOnly = new SimpleDateFormat("yyyy-MM-dd");
    timeOnly = new SimpleDateFormat("hh:mm:ss");
    dateTime = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
    datForFile = new SimpleDateFormat("yyyy-MM-dd __ hh mm ss");
}

From source file:tprog.web.DescargarPDF.java

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    HttpSession session = request.getSession(false);
    URL wsdlLocation = new URL(getServletContext().getInitParameter("wsdl"));
    webservice.PublicadorService service = new webservice.PublicadorService(wsdlLocation);
    webservice.Publicador proxy = service.getPublicadorPort();
    System.out.println("Llego hasta el servlet");
    //response.setContentType("application/pdf");
    try {/*from w w  w. java 2s . c  o m*/
        String idReservaString = request.getParameter("idReserva");
        response.setContentType("application/pdf");
        Integer idReserva = Integer.parseInt(idReservaString);
        WrapperVerFactura wrapper = proxy.verFactura(idReserva);
        DtFacturaF dtf = wrapper.getFactura();
        Set<DtServicioF> servicios = new HashSet(dtf.getServicios());
        Set<DtPromocionF> promociones = new HashSet(dtf.getPromociones());
        String fecha = Integer.toString(dtf.getFecha().getDay()) + "-"
                + Integer.toString(dtf.getFecha().getMonth()) + "-" + Integer.toString(dtf.getFecha().getYear())
                + "\n";
        //creo el documento pdf dinmicamente : no s donde se guarda
        //pero se genera a demanda siempre
        Document document = new Document();
        PdfWriter.getInstance(document, response.getOutputStream());
        document.open();
        document.add(new Paragraph("Detalles de la Factura",
                FontFactory.getFont("arial", 22, Font.ITALIC, BaseColor.BLACK)));
        document.add(new Paragraph(" "));
        //ingreso los datos de la factura
        document.add(new Paragraph("Id de la Reserva: " + idReservaString));
        document.add(new Paragraph("Fecha: " + fecha));
        document.add(new Paragraph("Cliente: " + dtf.getNicknameCliente()));
        document.add(new Paragraph("Monto: $" + dtf.getMonto()));
        document.add(new Paragraph(" "));
        //tabla para los servicios
        if (!servicios.isEmpty()) {
            document.add(new Paragraph("Servicios"));
            document.add(new Paragraph(" "));
            PdfPTable table = new PdfPTable(5);
            table.getDefaultCell().setBackgroundColor(BaseColor.LIGHT_GRAY);
            table.addCell("Item");
            table.addCell("Nombre");
            table.addCell("Cantidad");
            table.addCell("Precio");
            table.addCell("Proveedor");
            table.getDefaultCell().setBackgroundColor(null);
            int i = 1;
            for (DtServicioF servicio : servicios) {
                table.addCell(Integer.toString(i));
                table.addCell(servicio.getNombre());
                table.addCell(Integer.toString(servicio.getCantidad()));
                table.addCell(Double.toString(servicio.getPrecio()));
                table.addCell(servicio.getNicknameProveedor());
                i++;
            }
            document.add(table);
            document.add(new Paragraph(" "));
        }
        //tabla para las promos
        if (!promociones.isEmpty()) {
            document.add(new Paragraph("Promociones"));
            document.add(new Paragraph(" "));
            PdfPTable table = new PdfPTable(5);
            table.getDefaultCell().setBackgroundColor(BaseColor.LIGHT_GRAY);
            table.addCell("Item");
            table.addCell("Nombre");
            table.addCell("Cantidad");
            table.addCell("Precio");
            table.addCell("Proveedor");
            table.getDefaultCell().setBackgroundColor(null);
            int i = 1;
            for (DtPromocionF promocion : promociones) {
                table.addCell(Integer.toString(i));
                table.addCell(promocion.getNombre());
                table.addCell(Integer.toString(promocion.getCantidad()));
                table.addCell(Double.toString(promocion.getPrecio()));
                table.addCell(promocion.getNicknameProveedor());
                i++;
            }

            document.add(table);
            document.add(new Paragraph(" "));
        }
        document.close();
        //         session.setAttribute("descargaOK", "La descarga se complet correctamente.");
        response.sendRedirect("VerPerfil");
    } catch (DocumentException de) {
        throw new IOException(de.getMessage());
    }
}

From source file:util.ImageExample.java

public ImageExample(Calendar date, int settings, ArrayList<String> courses, String time, String eventAddress,
        int totalPrice, String comments, boolean kunde) throws Exception {
    this.date = date;
    this.settings = settings;
    this.courses = courses;
    this.time = time;
    this.eventAddress = eventAddress;
    this.totalPrice = totalPrice;
    this.comments = comments;
    this.fileName = "";
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    ge.getAllFonts();/*from w w  w .j  a  v  a2  s.c om*/
    FontFactory.register("C:/Windows/Fonts/ARLRDBD.TTF", "Arial Rounded");
    Font font = FontFactory.getFont("Arial Rounded", 22, Font.NORMAL, new BaseColor(51, 102, 102));
    Document document = new Document();

    System.out.println("Pdf creation startet");
    try {
        if (kunde) {
            fileName = "grill" + new SimpleDateFormat("dd. MMMMM yyyy hhmm").format(date.getTime()) + ".pdf";
        } else {
            fileName = "grill" + new SimpleDateFormat("dd. MMMMM yyyy hhmm").format(date.getTime())
                    + "Prisliste.pdf";
        }

        FileOutputStream file = new FileOutputStream(new File("C:/Users/Mark/Desktop", fileName));
        PdfWriter writer = PdfWriter.getInstance(document, file);
        document.open();

        Image img = Image.getInstance("src/pictures/cirkles.png");
        img.scaleToFit(277, 277);
        img.setAbsolutePosition(40, PageSize.A4.getHeight() - img.getHeight());
        document.add(img);
        Chunk chunk = new Chunk("Grillmester 'Frankie'", font);
        chunk.setCharacterSpacing(3);
        Paragraph header = new Paragraph(chunk);
        header.setAlignment(Element.ALIGN_RIGHT);
        header.setSpacingBefore(15);
        document.add(header);
        Paragraph title = new Paragraph(
                "Tilbud angende d. " + new SimpleDateFormat("dd. MMMMM yyyy").format(date.getTime()) + ".",
                new Font(Font.FontFamily.TIMES_ROMAN, 20, Font.BOLD));
        title.setAlignment(Element.ALIGN_LEFT);
        title.setIndentationLeft(235);
        title.setSpacingBefore(100);
        title.setLeading(17);
        document.add(title);
        Paragraph subtitle = new Paragraph("(Arrangement til " + settings + " personer).",
                new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.ITALIC));
        subtitle.setAlignment(Element.ALIGN_LEFT);
        subtitle.setIndentationLeft(235);
        subtitle.setLeading(17);
        document.add(subtitle);
        Paragraph body = new Paragraph("\n\nDer er aftalt:\n\n", new Font(Font.FontFamily.TIMES_ROMAN, 18));
        body.setAlignment(Element.ALIGN_LEFT);
        body.setIndentationLeft(235);
        body.setLeading(17);
        for (String course : courses) {
            body.add(course + "\n\n");
        }
        body.add("\nServeres klokken " + time + " i " + eventAddress + ".");
        document.add(body);
        Paragraph ending = new Paragraph("\n\n\nPris: " + totalPrice + ",-kr.",
                new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD));
        ending.setAlignment(Element.ALIGN_LEFT);
        ending.setIndentationLeft(235);
        ending.setLeading(17);
        document.add(ending);
        if (!comments.equals("null")) {
            if (!comments.equals("")) {
                Paragraph comment = new Paragraph("\n\nKommentarer\n" + comments,
                        new Font(Font.FontFamily.TIMES_ROMAN, 18));
                comment.setAlignment(Element.ALIGN_LEFT);
                comment.setIndentationLeft(235);
                comment.setLeading(17);
                document.add(comment);
            }
        }

        Image footerImg = Image.getInstance("src/pictures/grillmester.png");
        footerImg.scaleToFit(210, 210);
        footerImg.setAbsolutePosition(40, 40);
        document.add(footerImg);

        Image img2 = Image.getInstance("src/pictures/Contact.png");
        img2.scaleToFit(250, 250);
        img2.setAbsolutePosition(20, PageSize.A4.getHeight() - img.getHeight() - 250);
        document.add(img2);

        document.close();

        System.out.println("Pdf finish");
    } catch (Exception e) {
        e.printStackTrace();
        System.out.println(e.getLocalizedMessage());
    }
}