Example usage for com.itextpdf.text BaseColor GRAY

List of usage examples for com.itextpdf.text BaseColor GRAY

Introduction

In this page you can find the example usage for com.itextpdf.text BaseColor GRAY.

Prototype

BaseColor GRAY

To view the source code for com.itextpdf.text BaseColor GRAY.

Click Source Link

Usage

From source file:br.com.ifrn.panfleto.gui.PainelCadastrar.java

public BaseColor corPagina() {
    if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Branco")) {
        return BaseColor.WHITE;
    } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Preto")) {
        return BaseColor.BLACK;
    } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Azul")) {
        return BaseColor.BLUE;
    } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Cinza Escuro")) {
        return BaseColor.DARK_GRAY;
    } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Cinza")) {
        return BaseColor.GRAY;
    } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Cinza Claro")) {
        return BaseColor.LIGHT_GRAY;
    } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Magenta")) {
        return BaseColor.MAGENTA;
    } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Laranja")) {
        return BaseColor.ORANGE;
    } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Rosa")) {
        return BaseColor.PINK;
    } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Vermlho")) {
        return BaseColor.RED;
    } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Amarero")) {
        return BaseColor.YELLOW;
    } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Cyan")) {
        return BaseColor.CYAN;
    }//from  w w  w  . ja v a2s .c  o m

    return BaseColor.WHITE;
}

From source file:classes.utils.crearPDF_Depreciacion.java

public String writePDF(String datos, Scene scene)
        throws FileNotFoundException, DocumentException, BadElementException, IOException {

    javafx.scene.control.TextField projectName = (TextField) scene.lookup(CNodeID.TEXTFIELD_PROJECT_NAME);
    String project = projectName.getText();

    StringTokenizer st = new StringTokenizer(datos, "_");

    principal = st.nextToken();//from   w w w.jav a  2 s . c o  m
    salvageV = st.nextToken();
    period = st.nextToken();
    tax = st.nextToken();
    periodSalvage = st.nextToken();
    category = st.nextToken();
    data = st.nextToken();

    Document document = new Document(PageSize.LETTER, 80, 80, 50, 50);
    FileOutputStream salida = new FileOutputStream(project + "_depreciation.pdf");
    PdfWriter writer = PdfWriter.getInstance(document, salida);
    writer.setInitialLeading(0);

    Paragraph paragraph = new Paragraph();
    paragraph.setFont(new Font(FontFactory.getFont("Courier", 20, Font.BOLDITALIC, BaseColor.RED)));
    paragraph.add("\n\n\nDEPRECIACION");
    paragraph.setAlignment(Paragraph.ALIGN_CENTER);

    //System.out.println(getClass().getResource("images/logo_report.png"));
    //Image image = Image.getInstance("/home/isaac/IdeaProjects/ProjectEvaluation/src/images/logo_report.png");

    //image.scaleToFit(150, 150);

    Image image1 = Image.getInstance(project + "/" + project + "_DEP_TY.png");

    image1.scaleToFit(300, 300);

    //image.setAlignment(Chunk.ALIGN_RIGHT);
    image1.setAlignment(Chunk.ALIGN_CENTER);

    Paragraph paragraph_2 = new Paragraph();
    paragraph_2.setFont(new Font(FontFactory.getFont("Courier", 12, Font.BOLD, BaseColor.BLUE)));
    paragraph_2.add(
            "\n\n\n\n\n\n\n\n\n\n\nADMINISTRACION Y EVALUACION DE PROYECTOS\n\n SERGIO VALDES TORRES A01365520\n ERIK MARTIN A01365096\nISAAC SECUNDINO A01361162\n IVAN CABRER A01184937");
    paragraph_2.setAlignment(Paragraph.ALIGN_RIGHT);

    Paragraph paragraph_3 = new Paragraph();
    paragraph_3.setFont(new Font(FontFactory.getFont("Courier", 11, Font.BOLD, BaseColor.BLACK)));
    paragraph_3.add("\n " + data);
    paragraph_3.setAlignment(Paragraph.ALIGN_LEFT);

    Paragraph paragraph_5 = new Paragraph();
    paragraph_5.setFont(new Font(FontFactory.getFont("Courier", 6, Font.BOLD, BaseColor.BLUE)));
    paragraph_5.add("\n\nP   DEPRECIATON RATE  ANNUAL DEPRECIATON  CUMMULATIVE DEPRECIATON  VALUE IN LEDGERS ");
    paragraph_5.setAlignment(Paragraph.ALIGN_LEFT);

    Paragraph paragraph_4 = new Paragraph();
    paragraph_4.setFont(new Font(FontFactory.getFont("Courier", 9, Font.BOLD, BaseColor.BLACK)));
    paragraph_4.add("Nombre del Evaluador: \n Principal: " + principal + " \n Salvag Value: " + salvageV
            + " \n Numero de Periodos: " + period + "\n Tax: " + tax + " \n Salvage Period: " + periodSalvage
            + "\n Categoria: " + category);
    paragraph_4.setAlignment(Paragraph.ALIGN_LEFT);

    Paragraph paragraph_6 = new Paragraph();
    paragraph_6.setFont(new Font(FontFactory.getFont("Courier", 15, Font.BOLD, BaseColor.GRAY)));
    paragraph_6.add("\n GRAFICAS\n");
    paragraph_6.setAlignment(Paragraph.ALIGN_CENTER);

    document.open();
    //document.add(image);

    document.add(paragraph);

    document.add(paragraph_4);
    document.add(paragraph_5);
    document.add(paragraph_3);
    document.add(paragraph_6);
    Image image2 = Image.getInstance(project + "/" + project + "_DEP_DR.png");
    Image image3 = Image.getInstance(project + "/" + project + "_DEP_AD.png");
    Image image4 = Image.getInstance(project + "/" + project + "_DEP_ACD.png");
    Image image5 = Image.getInstance(project + "/" + project + "_DEP_LV.png");
    document.add(image2);
    document.add(image3);
    document.add(image4);
    document.add(image5);
    document.add(image1);
    document.add(paragraph_2);
    document.close();
    return null;

}

From source file:classes.utils.createPDF_NetPresent.java

public String writePDF(Scene scene, String datos)
        throws FileNotFoundException, DocumentException, BadElementException, IOException {

    javafx.scene.control.TextField projectName = (javafx.scene.control.TextField) scene
            .lookup(CNodeID.TEXTFIELD_PROJECT_NAME);
    String project = projectName.getText();
    StringTokenizer st = new StringTokenizer(datos, "_");

    period = st.nextToken();//from   w ww.  jav  a 2  s . com
    principal = st.nextToken();
    interestRate = st.nextToken();
    tax = st.nextToken();
    salvageV = st.nextToken();
    periodSalvage = st.nextToken();
    data = st.nextToken();

    Document document = new Document(PageSize.LETTER, 80, 80, 50, 50);
    FileOutputStream salida = new FileOutputStream(project + "_NetPresentValue.pdf");
    PdfWriter writer = PdfWriter.getInstance(document, salida);
    writer.setInitialLeading(0);

    Paragraph paragraph = new Paragraph();
    paragraph.setFont(new Font(FontFactory.getFont("Courier", 20, Font.BOLDITALIC, BaseColor.RED)));
    paragraph.add("\n\n\nNET PRESENT VALUE");
    paragraph.setAlignment(Paragraph.ALIGN_CENTER);

    //Image image = Image.getInstance("/home/isaac/IdeaProjects/ProjectEvaluation/src/images/logo_report.png");

    //image.scaleToFit(150, 150);

    Image image1 = Image.getInstance(project + "/" + project + "_NPV_CCF.png");

    image1.scaleToFit(300, 300);

    //image.setAlignment(Chunk.ALIGN_RIGHT);
    image1.setAlignment(Chunk.ALIGN_CENTER);

    Paragraph paragraph_2 = new Paragraph();
    paragraph_2.setFont(new Font(FontFactory.getFont("Courier", 12, Font.BOLD, BaseColor.BLUE)));
    paragraph_2.add(
            "\n\n\n\n\n\n\n\n\n\n\nADMINISTRACION Y EVALUACION DE PROYECTOS\n\n SERGIO VALDES TORRES A01365520\n ERIK MARTIN A01365096\nISAAC SECUNDINO A01361162\n IVAN CABRER A01184937");
    paragraph_2.setAlignment(Paragraph.ALIGN_RIGHT);

    Paragraph paragraph_3 = new Paragraph();
    paragraph_3.setFont(new Font(FontFactory.getFont("Courier", 11, Font.BOLD, BaseColor.BLACK)));
    paragraph_3.add("\n " + data);
    paragraph_3.setAlignment(Paragraph.ALIGN_LEFT);

    Paragraph paragraph_5 = new Paragraph();
    paragraph_5.setFont(new Font(FontFactory.getFont("Courier", 10, Font.BOLD, BaseColor.BLUE)));
    paragraph_5.add("\n\nP   OUTFLOW   INFLOW   NET CASH FLOW   CUMULATIVE CASH ");
    paragraph_5.setAlignment(Paragraph.ALIGN_LEFT);

    Paragraph paragraph_4 = new Paragraph();
    paragraph_4.setFont(new Font(FontFactory.getFont("Courier", 9, Font.BOLD, BaseColor.BLACK)));
    paragraph_4.add("Nombre del Evaluador: \nPeriods: " + period + "\n Principal: " + principal
            + " \n Interest Rate%: " + interestRate + " \n Tax Rate %: " + tax + "\n Salvage Value: " + salvageV
            + " \n Period SV: " + periodSalvage);
    paragraph_4.setAlignment(Paragraph.ALIGN_LEFT);

    Paragraph paragraph_6 = new Paragraph();
    paragraph_6.setFont(new Font(FontFactory.getFont("Courier", 15, Font.BOLD, BaseColor.GRAY)));
    paragraph_6.add("\n GRAFICAS\n");
    paragraph_6.setAlignment(Paragraph.ALIGN_CENTER);

    document.open();
    //document.add(image);

    document.add(paragraph);

    document.add(paragraph_4);
    document.add(paragraph_5);
    document.add(paragraph_3);
    document.add(paragraph_6);
    document.add(image1);
    Image image2 = Image.getInstance(project + "/" + project + "_NPV_NCF.png");
    document.add(image2);
    document.add(paragraph_2);
    document.close();
    return null;

}

From source file:classes.utils.createPDF_PayBack.java

public String writePDF(Scene scene, String datos)
        throws FileNotFoundException, DocumentException, BadElementException, IOException {

    javafx.scene.control.TextField projectName = (javafx.scene.control.TextField) scene
            .lookup(CNodeID.TEXTFIELD_PROJECT_NAME);
    String project = projectName.getText();

    StringTokenizer st = new StringTokenizer(datos, "_");

    period = st.nextToken();//from   w w w  .  j  av  a 2 s. c o m
    principal = st.nextToken();
    interestRate = st.nextToken();
    data = st.nextToken();

    Document document = new Document(PageSize.LETTER, 80, 80, 50, 50);
    FileOutputStream salida = new FileOutputStream(project + "_PayBackPeriod.pdf");
    PdfWriter writer = PdfWriter.getInstance(document, salida);
    writer.setInitialLeading(0);

    Paragraph paragraph = new Paragraph();
    paragraph.setFont(new Font(FontFactory.getFont("Courier", 20, Font.BOLDITALIC, BaseColor.RED)));
    paragraph.add("\n\n\nPAYBACK PERIOD");
    paragraph.setAlignment(Paragraph.ALIGN_CENTER);
    // TODO: Change absolute to relative
    //Image image = Image.getInstance("/home/isaac/IdeaProjects/ProjectEvaluation/src/images/logo_report.png");

    //image.scaleToFit(150, 150);

    Image image1 = Image.getInstance(project + "/" + project + "_PBP_CCF.png");

    image1.scaleToFit(300, 300);

    //image.setAlignment(Chunk.ALIGN_RIGHT);
    image1.setAlignment(Chunk.ALIGN_CENTER);

    Paragraph paragraph_2 = new Paragraph();
    paragraph_2.setFont(new Font(FontFactory.getFont("Courier", 12, Font.BOLD, BaseColor.BLUE)));
    paragraph_2.add(
            "\n\n\n\n\n\n\n\n\n\n\nADMINISTRACION Y EVALUACION DE PROYECTOS\n\n SERGIO VALDES TORRES A01365520\n ERIK MARTIN A01365096\nISAAC SECUNDINO A01361162\n IVAN CABRER A01184937");
    paragraph_2.setAlignment(Paragraph.ALIGN_RIGHT);

    Paragraph paragraph_3 = new Paragraph();
    paragraph_3.setFont(new Font(FontFactory.getFont("Courier", 11, Font.BOLD, BaseColor.BLACK)));
    paragraph_3.add("\n " + data);
    paragraph_3.setAlignment(Paragraph.ALIGN_LEFT);

    Paragraph paragraph_5 = new Paragraph();
    paragraph_5.setFont(new Font(FontFactory.getFont("Courier", 10, Font.BOLD, BaseColor.BLUE)));
    paragraph_5.add("\n\nP   OUTFLOW  INFLOW  CUMMULATIVE CASH... ");
    paragraph_5.setAlignment(Paragraph.ALIGN_LEFT);

    Paragraph paragraph_4 = new Paragraph();
    paragraph_4.setFont(new Font(FontFactory.getFont("Courier", 9, Font.BOLD, BaseColor.BLACK)));
    paragraph_4.add("Nombre del Evaluador: \n Principal: " + principal + " \n Numero de Periodos: " + period
            + "\nInterest Rate %" + interestRate);
    paragraph_4.setAlignment(Paragraph.ALIGN_LEFT);

    Paragraph paragraph_6 = new Paragraph();
    paragraph_6.setFont(new Font(FontFactory.getFont("Courier", 15, Font.BOLD, BaseColor.GRAY)));
    paragraph_6.add("\n GRAFICAS\n");
    paragraph_6.setAlignment(Paragraph.ALIGN_CENTER);

    document.open();
    //document.add(image);

    document.add(paragraph);

    document.add(paragraph_4);
    document.add(paragraph_5);
    document.add(paragraph_3);
    document.add(paragraph_6);
    Image image2 = Image.getInstance(project + "/" + project + "_PBP_NCF.png");
    document.add(image1);
    document.add(image2);
    document.add(paragraph_2);
    document.close();
    return null;

}

From source file:com.ashish.medicine.admin.invoice.InvoiceAction.java

private void createTable(Document document) throws DocumentException, MalformedURLException, IOException {

    PdfPTable table = new PdfPTable(8);
    table.setWidths(new int[] { 5, 10, 30, 15, 15, 15, 25, 20 });
    // t.setBorderColor(BaseColor.GRAY);
    // t.setPadding(4);
    // t.setSpacing(4);
    // t.setBorderWidth(1);
    //       addLogo(table);
    String[] headerTitle = { "Sl", "Qty", "Medicine Name", "Mfg Date", "Batch", "Exp Date", "Schedule",
            "Price" };
    Font headerFont = new Font(Font.FontFamily.TIMES_ROMAN, 10f, Font.BOLD);
    for (String header : headerTitle) {
        Phrase p = new Phrase(header, headerFont);
        PdfPCell c1 = new PdfPCell(p);
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        c1.setLeading(0f, 1.5f);//w  w w.j  ava  2  s .co m
        c1.setBackgroundColor(BaseColor.GRAY);
        table.addCell(c1);
    }

    Font contentFont = new Font(Font.FontFamily.TIMES_ROMAN, 9f);
    MedicineUtility mUtil = new MedicineUtility();
    //       table.setSpacingAfter(20);
    double vat = 0.0;
    double discount = 0.0;
    int count = 1;
    double totalAmt = 0.0;
    if (totalRecords != null && totalRecords.size() > 0) {
        for (InvoiceBean iBean : totalRecords) {
            //              replaceDoctor = iBean.getDoctorName();
            //              replaceCustomer = iBean.getCustomerName();
            //              replaceCustAddr1 = iBean.getCustomerAddr1();
            //              replaceBillNo = iBean.getBillNo();
            //              replaceBillDate = iBean.getPurchaseDate();
            vat = iBean.getVat();
            discount = iBean.getDiscount();
            PdfPCell c = new PdfPCell(new Phrase(count++ + "", contentFont));
            table.addCell(c);
            c = new PdfPCell(new Phrase(iBean.getSoldoutStock() + "", contentFont));
            table.addCell(c);
            table.addCell(new PdfPCell(new Phrase(iBean.getMedicineName(), contentFont)));
            table.addCell(new PdfPCell(new Phrase(iBean.getMfgDate(), contentFont)));
            table.addCell(new PdfPCell(new Phrase(iBean.getBatchName(), contentFont)));
            table.addCell(new PdfPCell(new Phrase(iBean.getExpDate(), contentFont)));
            table.addCell(new PdfPCell(new Phrase(iBean.getSchedule(), contentFont)));
            totalAmt = totalAmt + (iBean.getSoldoutStock() * iBean.getSoldoutUnitPrice());
            table.addCell(new PdfPCell(new Phrase(
                    mUtil.getFormattedAmount((iBean.getSoldoutStock() * iBean.getSoldoutUnitPrice())),
                    contentFont)));
        }
    }
    double grandTotal = 0.0;

    // Total
    PdfPCell c1 = new PdfPCell(new Phrase("Total"));
    c1.setColspan(7);
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase(mUtil.getFormattedAmount(totalAmt)));
    c1.setColspan(1);
    table.addCell(c1);

    // Vat
    c1 = new PdfPCell(new Phrase("Vat(" + vat + "%)"));
    c1.setColspan(7);
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    double vatAmt = totalAmt * vat / 100;
    c1 = new PdfPCell(new Phrase(mUtil.getFormattedAmount(vatAmt)));
    c1.setColspan(1);
    table.addCell(c1);

    // Discount
    c1 = new PdfPCell(new Phrase("Discount(" + discount + "%)"));
    c1.setColspan(7);
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    double discountAmt = totalAmt * discount / 100;
    c1 = new PdfPCell(new Phrase(mUtil.getFormattedAmount(discountAmt)));
    c1.setColspan(1);
    table.addCell(c1);

    // Grand Total
    c1 = new PdfPCell(new Phrase("Grand Total"));
    c1.setColspan(7);
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    grandTotal = (totalAmt + vatAmt - discountAmt);
    c1 = new PdfPCell(new Phrase(mUtil.getFormattedAmount(grandTotal)));
    c1.setColspan(1);
    table.addCell(c1);

    document.add(table);
}

From source file:com.atacadao.almoxarifado.model.GerandoPDF.java

public void pdfDeSaida(ArrayList<Equipamento> equipamentos, String solicitante, String autorizante,
        String responsavel, String numeroSaida) {
    Document documento = new Document();

    try {// ww  w.  j  ava  2s.c om

        Path path = Paths.get("\\files\\saidas.pdf");

        if (!Files.isDirectory(path.getParent())) {
            Files.createDirectory(path.getParent());
            Files.createFile(path);
        }

        PdfWriter pdf;
        pdf = PdfWriter.getInstance(documento, new FileOutputStream("\\files\\saidas.pdf"));

        documento.open();
        documento.addTitle("SOLICITAO DE EQUIPAMENTOS E PRODUTOS");

        /**
         * Responsavel pelo cabealho do documento
         */
        Image imagem = Image.getInstance("atacadao.jpg");
        imagem.setAlignment(Element.ALIGN_CENTER);
        documento.add(imagem);

        Paragraph titulo = new Paragraph("SOLICITAO DE EQUIPAMENTOS E PRODUTOS", new com.itextpdf.text.Font(
                com.itextpdf.text.Font.FontFamily.UNDEFINED, 16, 0, BaseColor.BLACK));

        titulo.setAlignment(Element.ALIGN_CENTER);
        documento.add(titulo);

        documento.setMargins(0, 0, 18, 0);

        Date datas = new Date();
        Locale local = new Locale("pt", "BR");
        SimpleDateFormat sdf = new SimpleDateFormat("E dd/MM/yyyy", local);

        Paragraph espaco = new Paragraph(
                "\n\nDeclaro para os devidos fins que eu " + solicitante + " recebi na " + sdf.format(datas)
                        + " os equipamentos abaixo relacionados da empresa " + "Atacado dos Pisos por "
                        + autorizante + " e autorizado por " + responsavel + ".\n",
                new com.itextpdf.text.Font(com.itextpdf.text.Font.FontFamily.UNDEFINED, 12, 0,
                        BaseColor.BLACK));

        documento.add(espaco);

        documento.add(new Paragraph("\n Numero de registro : " + numeroSaida + "\n\n"));
        /**
         * Responsavel por cria a tabela da sada dos equipamentos
         */
        PdfPTable pdfT = new PdfPTable(4);
        PdfPCell celulas = new PdfPCell(new Paragraph(
                "Relao de equipamentos solicitados para seus devidos fins."
                        + " Favor caso haja devoluo manter o maximo possvel do estado atual dos mesmos. Grato !!!",
                new com.itextpdf.text.Font(com.itextpdf.text.Font.FontFamily.UNDEFINED, 11, 0,
                        BaseColor.GRAY)));
        celulas.setColspan(4);

        PdfPCell patrimonio = new PdfPCell(new Paragraph("PATRIMONIO", new com.itextpdf.text.Font(
                com.itextpdf.text.Font.FontFamily.UNDEFINED, 12, 0, BaseColor.WHITE)));
        patrimonio.setBackgroundColor(BaseColor.GRAY);
        patrimonio.setPadding((float) 1);

        PdfPCell Nome = new PdfPCell(new Paragraph("NOME", new com.itextpdf.text.Font(
                com.itextpdf.text.Font.FontFamily.UNDEFINED, 12, 0, BaseColor.WHITE)));
        Nome.setBackgroundColor(BaseColor.GRAY);
        Nome.setPadding((float) 1);

        PdfPCell Situacao = new PdfPCell(new Paragraph("SITUAO", new com.itextpdf.text.Font(
                com.itextpdf.text.Font.FontFamily.UNDEFINED, 12, 0, BaseColor.WHITE)));
        Situacao.setBackgroundColor(BaseColor.GRAY);
        Situacao.setPadding((float) 1);

        PdfPCell valor = new PdfPCell(new Paragraph("DESTINO", new com.itextpdf.text.Font(
                com.itextpdf.text.Font.FontFamily.UNDEFINED, 12, 0, BaseColor.WHITE)));
        valor.setBackgroundColor(BaseColor.GRAY);
        valor.setPadding((float) 1);

        pdfT.addCell(celulas);
        pdfT.addCell(patrimonio);
        pdfT.addCell(Nome);
        pdfT.addCell(Situacao);
        pdfT.addCell(valor);

        for (Equipamento equipamento : equipamentos) {

            PdfPCell patrimonios = new PdfPCell(
                    new Paragraph(equipamento.getPatrimonio(), new com.itextpdf.text.Font(
                            com.itextpdf.text.Font.FontFamily.UNDEFINED, 10, 0, BaseColor.BLACK)));
            patrimonios.setBackgroundColor(BaseColor.WHITE);
            Situacao.setPadding((float) 0.8);
            pdfT.addCell(patrimonios);

            PdfPCell nomes = new PdfPCell(new Paragraph(equipamento.getNome(), new com.itextpdf.text.Font(
                    com.itextpdf.text.Font.FontFamily.UNDEFINED, 10, 0, BaseColor.BLACK)));
            nomes.setBackgroundColor(BaseColor.WHITE);
            nomes.setPadding((float) 0.8);
            pdfT.addCell(nomes);

            PdfPCell situacoes = new PdfPCell(
                    new Paragraph(equipamento.getSituacao(), new com.itextpdf.text.Font(
                            com.itextpdf.text.Font.FontFamily.UNDEFINED, 10, 0, BaseColor.BLACK)));
            situacoes.setBackgroundColor(BaseColor.WHITE);
            situacoes.setPadding((float) 0.8);
            pdfT.addCell(situacoes);

            PdfPCell valores = new PdfPCell(new Paragraph(equipamento.getCodigo(), new com.itextpdf.text.Font(
                    com.itextpdf.text.Font.FontFamily.UNDEFINED, 10, 0, BaseColor.BLACK)));
            valores.setBackgroundColor(BaseColor.WHITE);
            valores.setPadding((float) 0.8);
            pdfT.addCell(valores);

        }
        documento.add(pdfT);

        /**
         * Cria tabela para assinatura do solicitante e autorizado
         */
        PdfPTable pdfTs = new PdfPTable(5);

        Paragraph sol = new Paragraph("\n\n" + solicitante,
                new com.itextpdf.text.Font(com.itextpdf.text.Font.FontFamily.UNDEFINED, 12, Font.ITALIC));
        sol.setAlignment(Element.ALIGN_CENTER);
        PdfPCell ass = new PdfPCell(sol);
        ass.setBorder(0);
        ass.setBorderWidthTop(1);
        ass.setColspan(2);

        PdfPCell espacos = new PdfPCell();
        espacos.setBorder(0);

        Paragraph auth = new Paragraph("\n\n" + autorizante,
                new com.itextpdf.text.Font(com.itextpdf.text.Font.FontFamily.UNDEFINED, 12, Font.ITALIC));
        auth.setAlignment(Element.ALIGN_CENTER);
        PdfPCell ass2 = new PdfPCell(auth);
        ass2.setBorder(0);
        ass2.setBorderWidthTop(1);
        ass2.setColspan(2);

        pdfTs.addCell(ass);
        pdfTs.addCell(espacos);
        pdfTs.addCell(ass2);

        documento.add(new Paragraph("\n\n\n"));
        documento.add(pdfTs);

        documento.close();
        ImpressaoDeDocumentos imprimir = new ImpressaoDeDocumentos("\\files\\saidas.pdf");

        //            Desktop.getDesktop().open(new File("\\files\\saidas.pdf"));

    } catch (DocumentException ex) {
        Logger.getLogger(GerandoPDF.class.getName()).log(Level.SEVERE, null, ex);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(GerandoPDF.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(GerandoPDF.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.ftt.gui.FrameFormation.java

private void pdf2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pdf2ActionPerformed

    FormationDAO fd = new FormationDAO();
    ArrayList<Formation> formations = (ArrayList<Formation>) fd.select();
    SimpleDateFormat formateur = new SimpleDateFormat("dd-MM-yyyy");

    Document document = new Document();

    try {//from  ww  w .j  a v a  2 s  .c  o m
        PdfWriter.getInstance(document, new FileOutputStream("rapport_formations.pdf"));

        document.open();

        com.itextpdf.text.Image image = com.itextpdf.text.Image.getInstance("ftt.png");
        document.add(image);
        document.add(new Paragraph("Liste des formations",
                FontFactory.getFont(FontFactory.TIMES_ROMAN, 18, Font.BOLD)));
        document.add(new Paragraph("   "));
        document.add(new Paragraph("    "));
        for (int i = 0; i < formations.size(); i++) {
            document.add(new Paragraph("    "));
            int val = formations.get(i).getId();
            String val1 = formations.get(i).getLieux();
            String val2 = formations.get(i).getDateOuverture();
            String val3 = formations.get(i).getDateCloture();
            String val4 = formations.get(i).getCible();
            String val5 = formations.get(i).getNom();
            String val6 = formations.get(i).getDescription();

            PdfPTable table = new PdfPTable(2);
            PdfPCell cell = new PdfPCell(new Paragraph("formation " + val));
            cell.setColspan(4);
            cell.setHorizontalAlignment(com.itextpdf.text.Element.ALIGN_CENTER);
            cell.setBackgroundColor(BaseColor.GRAY);
            table.addCell(cell);
            table.addCell("Nom formation");
            table.addCell(val5);
            table.addCell("Description");
            table.addCell(val6);
            table.addCell("Lieux");
            table.addCell(val1);
            table.addCell("Date d'ouverture");
            table.addCell(val2);
            table.addCell("Date de cloture");
            table.addCell(val3);
            table.addCell("Cible");
            table.addCell(val4);
            document.add(table);
        }

        document.add(new Paragraph("    "));
        document.add(new Paragraph("    "));
        document.add(new Paragraph("Responsable des formations"));
        document.add(new Paragraph("Federation Tunisenne de Tennis"));
        document.close();
        JOptionPane.showMessageDialog(null, "Rapport Enregistrer");
    } catch (Exception e) {
        JOptionPane.showMessageDialog(null, e);
    }
}

From source file:com.ftt.gui.FrameJoueur.java

private void pdf2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pdf2ActionPerformed

    JoueurDAO fd = new JoueurDAO();
    ArrayList<Joueur> joueurs = (ArrayList<Joueur>) fd.select_trie_par_club();
    SimpleDateFormat formateur = new SimpleDateFormat("dd-MM-yyyy");

    Document document = new Document();

    try {//  w  w  w . j  ava  2 s . c o  m
        PdfWriter.getInstance(document, new FileOutputStream("rapport_joueurs.pdf"));

        document.open();

        com.itextpdf.text.Image image = com.itextpdf.text.Image.getInstance("ftt.png");
        document.add(image);
        document.add(new Paragraph("Liste des joueurs",
                FontFactory.getFont(FontFactory.TIMES_ROMAN, 18, Font.BOLD)));
        document.add(new Paragraph("   "));

        for (int i = 0; i < joueurs.size(); i++) {
            document.add(new Paragraph("    "));
            document.add(new Paragraph(joueurs.get(i).getNom_club()));
            document.add(new Paragraph("   "));
            Integer val = joueurs.get(i).getId();
            String val1 = joueurs.get(i).getNomJoueur();
            String val2 = joueurs.get(i).getPrenomJoueur();
            String val3 = joueurs.get(i).getDateNaissance();
            String val4 = joueurs.get(i).getCarriere();
            String val5 = joueurs.get(i).getSexe();
            Integer val6 = joueurs.get(i).getPoints();
            PdfPTable table = new PdfPTable(2);
            PdfPCell cell = new PdfPCell(new Paragraph("Joueur id: " + val));
            cell.setColspan(4);
            cell.setHorizontalAlignment(com.itextpdf.text.Element.ALIGN_LEFT);
            cell.setBackgroundColor(BaseColor.GRAY);
            table.addCell(cell);
            table.addCell("Nom");
            table.addCell(val1);
            table.addCell("Prenom");
            table.addCell(val2);
            table.addCell("Date de naissance");
            table.addCell(val3);
            table.addCell("Carriere");
            table.addCell(val4);
            table.addCell("sexe");
            table.addCell(val5);
            table.addCell("points");
            table.addCell(val6.toString());
            document.add(table);
        }

        document.add(new Paragraph("    "));
        document.add(new Paragraph("    "));

        document.add(new Paragraph("Federation Tunisenne de Tennis"));
        document.close();
        JOptionPane.showMessageDialog(null, "Rapport Enregistrer");
    } catch (Exception e) {
        JOptionPane.showMessageDialog(null, e);
    }
}

From source file:com.mycom.products.mywebsite.backend.util.DownloadHandler.java

License:Open Source License

private void setTableHeader(String value, PdfPTable table) {
    PdfPCell cell = new PdfPCell(new Paragraph(value));
    cell.setBorderColor(BaseColor.GRAY);
    cell.setFixedHeight(25);/*from   w ww .j  a v a  2  s  .  co  m*/
    BaseColor myColor = WebColors.getRGBColor("#F7F7F7");
    cell.setBackgroundColor(myColor);
    cell.setPaddingLeft(10);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

}

From source file:com.mycom.products.mywebsite.backend.util.DownloadHandler.java

License:Open Source License

private void setTableContent(String value, PdfPTable table) {
    PdfPCell cell = new PdfPCell(new Paragraph(value));
    cell.setBorderColor(BaseColor.GRAY);
    cell.setPaddingLeft(10);//from w w w  .  ja  v  a 2 s . c om
    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);
}