Example usage for com.itextpdf.text Rectangle NO_BORDER

List of usage examples for com.itextpdf.text Rectangle NO_BORDER

Introduction

In this page you can find the example usage for com.itextpdf.text Rectangle NO_BORDER.

Prototype

int NO_BORDER

To view the source code for com.itextpdf.text Rectangle NO_BORDER.

Click Source Link

Document

This represents a rectangle without borders.

Usage

From source file:fr.ensicaen.yousign.GenerePDF.java

public void genere() {
    try {//  ww  w .  j a v  a2s.  co  m
        OutputStream file = new FileOutputStream(util.generePDFFilenameToUse());

        Document document = new Document();
        PdfWriter.getInstance(document, file);
        document.open();
        //
        // Affichage du logo, de la date et l'heure et avec ou sans frais
        //
        document.add(addEntete());
        //
        // Caractristiques du missionnaire (table: nom, prenom, courriel = 1re colonne, adresse = 2me colonne
        //
        PdfPTable tableIdentite = new PdfPTable(2);
        tableIdentite.setWidthPercentage(100);

        PdfPCell nomCell = new PdfPCell(
                new Phrase(new Chunk("Nom: " + util.getOrdreMission().getNomMissionnaire() + "\n" + "Prenom: "
                        + util.getOrdreMission().getPrenomMissionnaire() + "\n\n" + "Courriel: "
                        + util.getOrdreMission().getEmailMissionnaire(), fontItemSection)));
        nomCell.setBorder(Rectangle.NO_BORDER);
        tableIdentite.addCell(nomCell);

        Chunk adresseChunk = new Chunk("Adresse: " + "\n" + util.getOrdreMission().getRueMissionnaire() + "\n"
                + util.getOrdreMission().getCodepostalMissionnaire() + " "
                + util.getOrdreMission().getVilleMissionnaire() + "\n"
                + util.getOrdreMission().getPaysMissionnaire(), fontItemSection);
        PdfPCell adresseCell = new PdfPCell(new Phrase(adresseChunk));
        adresseCell.setBorder(Rectangle.NO_BORDER);
        tableIdentite.addCell(adresseCell);

        Paragraph identite;
        identite = new Paragraph();
        addEmptyLine(identite, 1);
        identite.add(tableIdentite);
        document.add(identite);
        //
        // Numero IBAN
        //
        Paragraph iban = new Paragraph();
        addEmptyLine(iban, 1);
        iban.add(new Chunk("Numro IBAN: " + util.getOrdreMission().getIban1() + " "
                + util.getOrdreMission().getIban2() + " " + util.getOrdreMission().getIban3() + " "
                + util.getOrdreMission().getIban4() + " " + util.getOrdreMission().getIban5() + " "
                + util.getOrdreMission().getIban6() + " " + util.getOrdreMission().getIban7(),
                fontItemSection));
        document.add(iban);
        //
        // Motif de la mission
        //
        Paragraph mission = new Paragraph();
        addEmptyLine(mission, 1);
        mission.add(
                new Chunk("Motif de la mission: " + util.getOrdreMission().getMotifMission(), fontItemSection));
        addEmptyLine(mission, 1);
        //
        // Dtails de la mission (lieu, dates, ...)
        //
        PdfPTable tableMission = new PdfPTable(7);
        tableMission.setWidthPercentage(100);
        float[] columnWidths = { 1f, 2f, 1.5f, 1f, 2f, 1.5f, 1f };
        tableMission.setWidths(columnWidths);
        PdfPCell cell;
        //
        // Ligne d'entete du tableau des dtails de la mission
        //
        tableMission.addCell("");
        cell = new PdfPCell(new Phrase("Lieu de dpart"));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tableMission.addCell(cell);
        cell = new PdfPCell(new Phrase("Date"));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tableMission.addCell(cell);
        cell = new PdfPCell(new Phrase("Heure"));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tableMission.addCell(cell);
        cell = new PdfPCell(new Phrase("Lieu d'arrive"));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tableMission.addCell(cell);
        cell = new PdfPCell(new Phrase("Date"));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tableMission.addCell(cell);
        cell = new PdfPCell(new Phrase("Heure"));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tableMission.addCell(cell);
        //
        // description du voyage aller
        //
        tableMission.addCell("Aller");
        cell = new PdfPCell(new Phrase(util.getOrdreMission().getLieuDepartAller()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tableMission.addCell(cell);
        cell = new PdfPCell(new Phrase(util.getOrdreMission().getDateDepartAller()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tableMission.addCell(cell);
        cell = new PdfPCell(new Phrase(util.getOrdreMission().getHeureDepartAller() + ":"
                + util.getOrdreMission().getMinuteDepartAller()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tableMission.addCell(cell);
        cell = new PdfPCell(new Phrase(util.getOrdreMission().getLieuArriveeAller()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tableMission.addCell(cell);
        cell = new PdfPCell(new Phrase(util.getOrdreMission().getDateArriveeAller()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tableMission.addCell(cell);
        cell = new PdfPCell(new Phrase(util.getOrdreMission().getHeureArriveeAller() + ":"
                + util.getOrdreMission().getMinuteArriveeAller()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tableMission.addCell(cell);

        //
        // Description du voyage retour
        //                
        tableMission.addCell("Retour");
        cell = new PdfPCell(new Phrase(util.getOrdreMission().getLieuDepartRetour()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tableMission.addCell(cell);
        cell = new PdfPCell(new Phrase(util.getOrdreMission().getDateDepartRetour()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tableMission.addCell(cell);
        cell = new PdfPCell(new Phrase(util.getOrdreMission().getHeureDepartRetour() + ":"
                + util.getOrdreMission().getMinuteDepartRetour()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tableMission.addCell(cell);
        cell = new PdfPCell(new Phrase(util.getOrdreMission().getLieuArriveeRetour()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tableMission.addCell(cell);
        cell = new PdfPCell(new Phrase(util.getOrdreMission().getDateArriveeRetour()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tableMission.addCell(cell);
        cell = new PdfPCell(new Phrase(util.getOrdreMission().getHeureArriveeRetour() + ":"
                + util.getOrdreMission().getMinuteArriveeRetour()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        tableMission.addCell(cell);

        mission.add(tableMission);
        document.add(mission);
        //
        // Moyens de transport
        //
        Paragraph moyensTransport = new Paragraph();
        addEmptyLine(moyensTransport, 1);
        moyensTransport.add(new Chunk("Moyens de transport utiliss\n", fontTitleSection));
        if (util.use("Passager")) {
            moyensTransport.add(new Chunk("Pas de frais de transport comme passager de la voiture de: "
                    + util.getOrdreMission().getNomConducteur() + "\n", fontItemSection));
        }
        if (util.use("Train")) {
            moyensTransport.add(new Chunk("Train:   Classe: " + util.getOrdreMission().getTrainClasse()
                    + "   Prix des billets: " + util.getOrdreMission().getTrainPrixBillet()
                    + "    Bon de commande: " + util.getOrdreMission().getTrainBonCommande()
                    + "   Carte affaire: " + util.getOrdreMission().getTrainCarteAffaire() + "\n",
                    fontItemSection));
        }
        if (util.use("Avion_Bateau")) {
            moyensTransport.add(new Chunk(
                    "Avion ou Bateau:   Classe: " + util.getOrdreMission().getAvionBateauClasse()
                            + "   Prix des billets: " + util.getOrdreMission().getAvionBateauPrixBillet()
                            + "   Bon de commande: " + util.getOrdreMission().getAvionBateauBonCommande()
                            + "   Carte affaire: " + util.getOrdreMission().getAvionBateauCarteAffaire() + "\n",
                    fontItemSection));
        }
        if (util.use("Vehicule_Service")) {
            moyensTransport.add(new Chunk(
                    "Voiture de service: " + util.getOrdreMission().getVehiculeService()
                            + "  Nombre de kilomtres: "
                            + util.getOrdreMission().getVehiculeServiceNombreKilometres() + "\n",
                    fontItemSection));
            moyensTransport.add(new Chunk(
                    "Nom des passagers: " + util.getOrdreMission().getVehiculeServiceNomPassagers() + "\n",
                    fontItemSection));
        }
        if (util.use("Vehicule_Personnel")) {
            moyensTransport.add(new Chunk(
                    "En vertu du dcret No 2006-781 du 3 juillet 2006: je soussign, "
                            + util.getOrdreMission().getPrenomMissionnaire() + " "
                            + util.getOrdreMission().getNomMissionnaire() + ", sollicite l'autorisation ",
                    fontItemSection));
            moyensTransport.add(new Chunk("d'utiliser mon vhicule de marque "
                    + util.getOrdreMission().getVehiculePersonnelMarque() + ", de puissance "
                    + util.getOrdreMission().getVehiculePersonnelPuissance() + ", d'immatriculation: "
                    + util.getOrdreMission().getVehiculePersonnelImmatriculation(), fontItemSection));
            moyensTransport.add(new Chunk(
                    ", de date d'acquisition " + util.getOrdreMission().getVehiculePersonnelDateAcquisition()
                            + " pour me rendre  " + util.getOrdreMission().getLieuArriveeAller(),
                    fontItemSection));
            moyensTransport.add(new Chunk(" et dclare avoir souscrit auprs de "
                    + util.getOrdreMission().getVehiculePersonnelNomAssureur()
                    + " une police d'assurance garantissant de manire illimite ma responsabilit personnelle aux termes ",
                    fontItemSection));
            moyensTransport.add(new Chunk(
                    "des articles 1382, 1383, 1384 du Code Civil, ainsi qu'ventuellement la responsabilit de l'Etat, y compris le cas o celle-ci est engage vis--vis des personnes transportes. ",
                    fontItemSection));
            moyensTransport
                    .add(new Chunk("Cette police comprend l'assurance contentieuse.\n", fontItemSection));
            moyensTransport.add(new Chunk(
                    "DECLARATION COMPLEMENTAIRE: je certifie avoir contract l'assurance complmentaire couvrant tous les risques non compris dans l'assurance obligatoire.\n",
                    fontItemSection));
        }
        addEmptyLine(moyensTransport, 1);
        if (util.use("taxi")) {
            moyensTransport.add(
                    new Chunk("Le Directeur autorise le remboursement d'un taxi " + "\n", fontItemSection));
        }
        if (util.use("vehicule_location")) {
            moyensTransport
                    .add(new Chunk("Le Directeur autorise le remboursement d'un vhicule de location " + "\n",
                            fontItemSection));
        }
        if (util.use("Vehicule_Service") || util.use("Vehicule_Personnel") || util.use("vehicule_location")) {
            moyensTransport
                    .add(new Chunk(
                            "\nJustication de l'utilisation du vhicule personnel ou de la location:"
                                    + util.getOrdreMission().getVehiculeJustificatif() + "\n",
                            fontItemSection));
            moyensTransport.add(
                    new Chunk("\nJe certifie tre en possession du permis de conduire depuis plus d'un an\n",
                            fontBoldItemSection));
        }

        document.add(moyensTransport);
        //
        // Frais annexe
        //
        Paragraph fraisAnnexe = new Paragraph();
        addEmptyLine(fraisAnnexe, 1);
        fraisAnnexe.add(new Chunk("Frais Annexe\n", fontTitleSection));
        fraisAnnexe.add(new Chunk("Frais d'inscription: " + util.getOrdreMission().getFraisInscription()
                + "    Montant: " + util.getOrdreMission().getMontantInscription() + " ", fontItemSection));
        document.add(fraisAnnexe);

        Paragraph avance = new Paragraph();
        addEmptyLine(avance, 1);
        avance.add(new Chunk("Avance: ", fontTitleSection));
        avance.add(new Chunk(util.getOrdreMission().getAvance(), fontItemSection));
        document.add(avance);
        //
        // Informations financieres
        //
        Paragraph finance = new Paragraph();
        addEmptyLine(finance, 1);
        finance.add(new Chunk("Informations financires\n", fontTitleSection));
        finance.add(new Chunk("Centre financier: " + util.getOrdreMission().getCentreFinancier()
                + "   Projet ou eOTP: " + util.getOrdreMission().getProjet() + "\n", fontItemSection));
        finance.add(new Chunk("Responsable financier: " + util.getOrdreMission().getPrenomResponsableFinancier()
                + " " + util.getOrdreMission().getNomResponsableFinancier() + "\n", fontItemSection));
        finance.add(
                new Chunk("Autorit hirarchique: " + util.getOrdreMission().getPrenomAutoriteHierarchique()
                        + " " + util.getOrdreMission().getNomAutoriteHierarchique(), fontItemSection));
        document.add(finance);
        //
        // Informations complementaires eventuelles
        //              
        if (util.getOrdreMission().getInformationsComplementaires() != null) {
            Paragraph informationsComplementaires = new Paragraph();
            informationsComplementaires.add(new Chunk("\nInformations complementaires: ", fontTitleSection));
            informationsComplementaires
                    .add(new Chunk(util.getOrdreMission().getInformationsComplementaires(), fontItemSection));
            document.add(informationsComplementaires);
        }

        document.close();
        file.close();
    } catch (DocumentException | IOException e) {
        System.err
                .println("Erreur a la generation du fichier " + util.getPdfFileName() + ": " + e.getMessage());
    }
}

From source file:fr.ensicaen.yousign.GenerePDF.java

private Paragraph addEntete() {
    Paragraph paragraph = new Paragraph();
    PdfPTable table = new PdfPTable(2);
    table.setWidthPercentage(100);//from w ww  .  j  ava2s  . c  o  m
    try {
        //
        // Affichage du logo
        //
        PdfPCell logoCell = new PdfPCell(Image.getInstance(YousignConfig.LOGO), false); // false: le logo ne remplit pas toute la cellule
        logoCell.setBorder(Rectangle.NO_BORDER);
        table.addCell(logoCell);
        //
        // Affichage de la  date et du titre
        //
        Date date = new Date();
        DateFormat format_fr = DateFormat.getDateInstance(DateFormat.FULL, Locale.FRENCH);
        PdfPCell titleCell = new PdfPCell(new Phrase(
                new Chunk(format_fr.format(date) + "\n\n" + title + util.getOrdreMission().getNumeroMission()
                        + "\n" + util.getOrdreMission().getFrais(), fontItemTitleSection)));
        titleCell.setBorder(Rectangle.NO_BORDER);
        titleCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        titleCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        table.addCell(titleCell);
    } catch (BadElementException | IOException ex) {
        Logger.getLogger(GenerePDF.class.getName()).log(Level.SEVERE, null, ex);
    }
    paragraph.add(table);
    return paragraph;
}

From source file:fr.ybonnel.breizhcamppdf.PdfRenderer.java

License:Apache License

private void addSponsor(PdfPTable sponsors, String imageUrl, int colspan)
        throws DocumentException, IOException {
    PdfPCell sponsor = new PdfPCell();
    sponsor.setImage(Image.getInstance(imageUrl));
    sponsor.setColspan(colspan);/*from w  w w  .j  a va2 s .  co m*/
    sponsor.setBorder(Rectangle.NO_BORDER);
    sponsor.setVerticalAlignment(Element.ALIGN_MIDDLE);
    sponsors.addCell(sponsor);
}

From source file:fr.ybonnel.breizhcamppdf.PdfRenderer.java

License:Apache License

private void addLegend(Set<String> tracksInPage) throws DocumentException {
    PdfPTable legend = new PdfPTable(tracksInPage.size() + 1);
    legend.setWidthPercentage(100f);//from w  ww .  j  a  va  2s. c o m
    PdfPCell cellTitle = new PdfPCell(new Phrase("Lgende : ", speakerFont));
    cellTitle.setBorder(Rectangle.NO_BORDER);
    cellTitle.setHorizontalAlignment(Element.ALIGN_CENTER);
    cellTitle.setPadding(2);
    legend.addCell(cellTitle);

    for (String track : tracksInPage) {
        PdfPCell color = new PdfPCell(new Phrase(track, speakerFont));
        color.setHorizontalAlignment(Element.ALIGN_CENTER);
        color.setPadding(2);
        color.setBackgroundColor(mapTrack.get(track));
        legend.addCell(color);
    }
    tracksInPage.clear();
    document.add(legend);
}

From source file:fr.ybonnel.breizhcamppdf.PdfRenderer.java

License:Apache License

private void remplirCellWithTalk(PdfPCell cell, Talk talk) throws DocumentException, IOException {
    Image image = AvatarService.INSTANCE.getImage(
            PdfRenderer.class.getResource("/formats/" + talk.getFormat().replaceAll(" ", "") + ".png"));

    float[] widths = { 0.15f, 0.85f };
    PdfPTable table = new PdfPTable(widths);
    table.setWidthPercentage(100f);//w w  w  .j  av a  2  s . c  o  m
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    table.addCell(image);
    PdfPCell subCell = new PdfPCell();
    Chunk chunk = new Chunk(talk.getTitle(), talkFont);
    chunk.setLocalGoto("talk" + talk.getId());
    Paragraph titleTalk = new Paragraph();
    titleTalk.add(chunk);
    titleTalk.setAlignment(Paragraph.ALIGN_CENTER);
    subCell.addElement(titleTalk);
    Paragraph track = new Paragraph(new Phrase(talk.getTrack(), themeFont));
    track.setAlignment(Paragraph.ALIGN_CENTER);

    subCell.addElement(track);
    TalkDetail detail = TalkService.INSTANCE.getTalkDetail(talk);
    if (detail != null) {
        for (Speaker speaker : detail.getSpeakers()) {
            Paragraph speakerText = new Paragraph(speaker.getFullname(), speakerFont);
            speakerText.setAlignment(Paragraph.ALIGN_CENTER);
            subCell.addElement(speakerText);
        }
    }
    subCell.setBorder(Rectangle.NO_BORDER);
    table.addCell(subCell);
    cell.setBackgroundColor(mapTrack.get(talk.getTrack()));
    cell.addElement(table);
}

From source file:fr.ybonnel.breizhcamppdf.PdfRenderer.java

License:Apache License

private void createTalksPages(List<Talk> talksToExplain) throws DocumentException, IOException {
    document.setPageSize(PageSize.A4);//from w  w  w  .j a  va  2 s .  c o  m
    document.newPage();

    Paragraph paragraph = new Paragraph("Liste des talks");
    paragraph.setSpacingAfter(25);
    paragraph.getFont().setSize(25);
    paragraph.setAlignment(Element.ALIGN_CENTER);
    document.add(paragraph);

    for (TalkDetail talk : Lists.transform(talksToExplain, new Function<Talk, TalkDetail>() {
        @Override
        public TalkDetail apply(Talk input) {
            return TalkService.INSTANCE.getTalkDetail(input);
        }
    })) {

        if (talk == null) {
            continue;
        }

        Paragraph empty = new Paragraph(" ");
        PdfPTable table = new PdfPTable(1);
        table.setWidthPercentage(100);
        table.setKeepTogether(true);
        table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        PdfPCell cell;
        Chunk titleTalk = new Chunk(talk.getTitle(), talkFontTitle);
        titleTalk.setLocalDestination("talk" + talk.getId());
        float[] withTitle = { 0.05f, 0.95f };
        PdfPTable titleWithFormat = new PdfPTable(withTitle);
        titleWithFormat.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        titleWithFormat.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);

        Image image = AvatarService.INSTANCE.getImage(PdfRenderer.class
                .getResource("/formats/" + talk.getTalk().getFormat().replaceAll(" ", "") + ".png"));
        titleWithFormat.addCell(image);
        titleWithFormat.addCell(new Paragraph(titleTalk));

        table.addCell(titleWithFormat);

        table.addCell(empty);

        table.addCell(new Paragraph("Salle " + talk.getTalk().getRoom() + " de " + talk.getTalk().getStart()
                + "  " + talk.getTalk().getEnd(), presentFont));

        table.addCell(empty);

        cell = new PdfPCell();
        cell.setBorder(0);
        cell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
        for (Element element : HTMLWorker
                .parseToList(new StringReader(markdownProcessor.markdown(talk.getDescription())), null)) {
            if (element instanceof Paragraph) {
                ((Paragraph) element).setAlignment(Element.ALIGN_JUSTIFIED);
            }
            cell.addElement(element);
        }
        table.addCell(cell);

        table.addCell(empty);

        table.addCell(new Paragraph("Prsent par :", presentFont));

        float[] widthSpeaker = { 0.05f, 0.95f };
        for (Speaker speaker : talk.getSpeakers()) {
            PdfPTable speakerWithAvatar = new PdfPTable(widthSpeaker);
            speakerWithAvatar.getDefaultCell().setBorder(Rectangle.NO_BORDER);
            speakerWithAvatar.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);

            speakerWithAvatar.addCell(AvatarService.INSTANCE.getImage(speaker.getAvatar()));
            speakerWithAvatar.addCell(new Phrase(speaker.getFullname()));
            table.addCell(speakerWithAvatar);
        }

        table.addCell(empty);
        table.addCell(empty);
        document.add(table);
    }
}

From source file:fr.ybonnel.breizhcamppdf.RoomPdfRenderer.java

License:Apache License

private void remplirCellWithTalk(PdfPCell cell, Talk talk) throws DocumentException, IOException {
    Image image = AvatarService.INSTANCE.getImage(
            RoomPdfRenderer.class.getResource("/formats/" + talk.getFormat().replaceAll(" ", "") + ".png"));

    float[] widths = { 0.05f, 0.95f };
    PdfPTable table = new PdfPTable(widths);
    table.setWidthPercentage(100f);/*  w w  w  .  j a  v a 2s . c o m*/
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    table.addCell(image);
    PdfPCell subCell = new PdfPCell();
    Chunk chunk = new Chunk(talk.getTitle(), talkFont);
    chunk.setLocalGoto("talk" + talk.getId());
    Paragraph titleTalk = new Paragraph();
    titleTalk.add(chunk);
    titleTalk.setAlignment(Paragraph.ALIGN_CENTER);
    subCell.addElement(titleTalk);
    Paragraph track = new Paragraph(new Phrase(talk.getTrack(), themeFont));
    track.setAlignment(Paragraph.ALIGN_CENTER);

    subCell.addElement(track);
    TalkDetail detail = TalkService.INSTANCE.getTalkDetail(talk);
    if (detail != null) {
        for (Speaker speaker : detail.getSpeakers()) {
            Paragraph speakerText = new Paragraph(speaker.getFullname(), speakerFont);
            speakerText.setAlignment(Paragraph.ALIGN_CENTER);
            subCell.addElement(speakerText);
        }
    }
    subCell.setBorder(Rectangle.NO_BORDER);
    table.addCell(subCell);
    cell.setBackgroundColor(mapTrack.get(talk.getTrack()));
    cell.addElement(table);
}

From source file:fxml.test.PDFService.java

private PdfPTable createDocumentHeader() throws IOException, BadElementException {

    //start creating header for the document......
    PdfPTable headerTable = new PdfPTable(3);
    headerTable.setHorizontalAlignment(Element.ALIGN_LEFT);
    try {// www  . ja va2s .c  om
        headerTable.setTotalWidth(new float[] { 57.5f, 531.5f, 183f });
        headerTable.setLockedWidth(true);

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

    Image image = Image.getInstance(getClass().getClassLoader().getResource("img/sust.jpg"));
    image.scalePercent(42f);
    image.setAlignment(Element.ALIGN_LEFT);
    PdfPCell imageCell = new PdfPCell(image, false);
    imageCell.setPaddingTop(6);
    imageCell.setBorder(Rectangle.NO_BORDER);
    headerTable.addCell(imageCell);

    //start info table.....
    PdfPTable infoTable = new PdfPTable(1);
    infoTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);

    String universityText = "SHAHJALAL UNIVERSITY OF SCIENCE & TECHNOLOGY SYLHET, BANGLADESH";
    String tabulationText = "TABULATION SHEET";
    String deptText = inputs.get(0).trim();

    String s1 = inputs.get(1).trim();
    String s2 = inputs.get(2).trim();
    String semesterText = ("B.Sc (Engg.) " + s1 + " SEMESTER EXAMINATION " + s2);

    String session = inputs.get(3).trim();
    String date = inputs.get(4).trim();

    String sessionDateText = ("SESSION:" + session + " EXAMINATION HELD IN: " + date);

    infoTable.addCell(getCellForHeaderString(universityText, 0, false, 0, Element.ALIGN_CENTER, font10, true));
    infoTable.addCell(getCellForHeaderString(tabulationText, 0, false, 0, Element.ALIGN_CENTER, font10, false));
    infoTable.addCell(getCellForHeaderString(deptText, 0, false, 0, Element.ALIGN_CENTER, font10, false));
    infoTable.addCell(getCellForHeaderString(semesterText, 0, false, 0, Element.ALIGN_CENTER, font10, false));
    infoTable
            .addCell(getCellForHeaderString(sessionDateText, 0, false, 0, Element.ALIGN_CENTER, font10, false));
    //end info table.....

    PdfPCell infoCell = new PdfPCell(infoTable);
    infoCell.setBorder(Rectangle.NO_BORDER);
    headerTable.addCell(infoCell);

    PdfPCell resultPublishDateCell = new PdfPCell(
            new Paragraph("Result Published On............................",
                    new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD)));
    resultPublishDateCell.setBorder(Rectangle.NO_BORDER);
    resultPublishDateCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    resultPublishDateCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    headerTable.addCell(resultPublishDateCell);
    headerTable.setSpacingAfter(17.5f);
    // System.err.println("completed header table");
    return headerTable;
    //end creating header for the document......
}

From source file:fxml.test.PDFService.java

public PdfPTable createFooter1() {

    //String[] names = new String[]{"Md. Eamin Rahman", "Md. Mujibur Rahman", "Md Masum", "Md. Saiful Islam", "Husne Ara Chowdhury", "Sabir Ismail"};
    PdfPTable table = new PdfPTable(5);
    table.setHorizontalAlignment(Element.ALIGN_LEFT);

    try {//  w  w w  .  j  a v  a2 s  .c om
        table.setTotalWidth(new float[] { 161f, 161f, 133f, 167f, 161f });
        table.setLockedWidth(true);

    } catch (DocumentException ex) {
        Logger.getLogger(PDFService.class.getName()).log(Level.SEVERE, null, ex);
    }
    //table.setWidthPercentage(100);
    PdfPCell chairmanSIgnature = new PdfPCell(new Paragraph("Signature of the Chairman:", font9));
    chairmanSIgnature.setBorder(Rectangle.NO_BORDER);
    chairmanSIgnature.setPaddingLeft(0f);
    chairmanSIgnature.setPaddingTop(5);
    table.addCell(chairmanSIgnature);

    PdfPCell underLine = new PdfPCell(new Paragraph("_______________________"));
    underLine.setBorder(Rectangle.NO_BORDER);
    table.addCell(underLine);

    PdfPCell blankColumn = new PdfPCell(new Paragraph(" "));
    blankColumn.setBorder(Rectangle.NO_BORDER);
    table.addCell(blankColumn);

    Paragraph p = new Paragraph("Signature of The Controller of Examinations:", font9);
    p.setLeading(0, 1.3f);
    PdfPCell controllerSignature = new PdfPCell();
    controllerSignature.addElement(p);
    controllerSignature.setBorder(Rectangle.NO_BORDER);
    table.addCell(controllerSignature);
    table.addCell(underLine);

    PdfPCell cell1 = new PdfPCell(new Paragraph(inputs.get(5).trim(), font9));
    cell1.setPaddingTop(0f);
    cell1.setBorder(Rectangle.NO_BORDER);

    PdfPCell cell2 = new PdfPCell(new Paragraph(inputs.get(6).trim(), font9));
    cell2.setPaddingTop(0f);
    cell2.setBorder(Rectangle.NO_BORDER);

    PdfPCell nameColumn = new PdfPCell(new Paragraph("Name :", font9));
    nameColumn.setBorder(Rectangle.NO_BORDER);
    nameColumn.setPaddingLeft(0f);
    nameColumn.setPaddingTop(0f);

    PdfPCell nameColumn2 = new PdfPCell(new Paragraph("Name :", font9));
    nameColumn2.setBorder(Rectangle.NO_BORDER);
    nameColumn2.setPaddingTop(0f);

    table.addCell(nameColumn);
    table.addCell(cell1);
    table.addCell(blankColumn);
    table.addCell(nameColumn2);
    table.addCell(cell2);

    table.setSpacingAfter(23.5f);
    return table;
}

From source file:fxml.test.PDFService.java

public PdfPTable createFooter2() {

    PdfPTable table = new PdfPTable(8);
    table.setHorizontalAlignment(Element.ALIGN_LEFT);

    try {/*from   w w  w .  j  a  v a 2s.  c  o  m*/
        table.setTotalWidth(new float[] { 192f, 144f, 5f, 144f, 5f, 144f, 5f, 144f });
        table.setLockedWidth(true);

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

    PdfPCell underLine = new PdfPCell(new Paragraph("_____________________"));
    underLine.setBorder(Rectangle.NO_BORDER);

    PdfPCell blankColumn = new PdfPCell(new Paragraph(" "));
    blankColumn.setBorder(Rectangle.NO_BORDER);

    PdfPCell blankColumn2 = new PdfPCell(new Paragraph(" "));
    blankColumn2.setBorder(Rectangle.BOTTOM);

    PdfPCell nameColumn = new PdfPCell(new Paragraph("Name :", font9));
    nameColumn.setBorder(Rectangle.NO_BORDER);
    nameColumn.setPaddingLeft(0f);

    PdfPCell cell3 = new PdfPCell(new Paragraph(inputs.get(7).trim(), font9));
    cell3.setPaddingRight(2);
    cell3.setBorder(Rectangle.TOP);

    PdfPCell cell4 = new PdfPCell(new Paragraph(inputs.get(8).trim(), font9));
    cell4.setBorder(Rectangle.TOP);

    PdfPCell cell5 = new PdfPCell(new Paragraph(inputs.get(9).trim(), font9));
    cell5.setBorder(Rectangle.TOP);

    PdfPCell cell6 = new PdfPCell(new Paragraph(inputs.get(10).trim(), font9));
    cell6.setBorder(Rectangle.TOP);

    PdfPCell memberSignature = new PdfPCell(new Paragraph("Signature of the Members:", font9));
    memberSignature.setPaddingLeft(0f);
    memberSignature.setBorder(Rectangle.NO_BORDER);

    table.addCell(memberSignature);
    table.addCell(blankColumn);
    table.addCell(blankColumn);
    table.addCell(blankColumn);
    table.addCell(blankColumn);
    table.addCell(blankColumn);
    table.addCell(blankColumn);
    table.addCell(blankColumn);

    table.addCell(nameColumn);
    table.addCell(cell3);
    table.addCell(blankColumn);
    table.addCell(cell4);
    table.addCell(blankColumn);
    table.addCell(cell5);
    table.addCell(blankColumn);
    table.addCell(cell6);

    PdfPCell tabulatorSignature = new PdfPCell(new Paragraph("Signature of the Tabulators:", font9));
    tabulatorSignature.setPaddingLeft(0f);
    tabulatorSignature.setPaddingTop(13f);
    tabulatorSignature.setBorder(Rectangle.NO_BORDER);

    table.addCell(tabulatorSignature);
    table.addCell(blankColumn2);
    table.addCell(blankColumn);
    table.addCell(blankColumn2);
    table.addCell(blankColumn);
    table.addCell(blankColumn2);
    table.addCell(blankColumn);
    table.addCell(blankColumn2);

    return table;

}