Example usage for com.itextpdf.text Document add

List of usage examples for com.itextpdf.text Document add

Introduction

In this page you can find the example usage for com.itextpdf.text Document add.

Prototype


public boolean add(Element element) throws DocumentException 

Source Link

Document

Adds an Element to the Document.

Usage

From source file:com.photon.phresco.service.docs.impl.DocumentUtil.java

License:Apache License

/**
 * Creates and returns PDF input stream for the supplied string.
 * @param string to be printed in the PDF
 * @return PDF input stream.//  w  w w.j av a 2  s  .co  m
 * @throws DocumentException
 */
public static InputStream getStringAsPDF(String string) throws DocumentException {
    if (isDebugEnabled) {
        S_LOGGER.debug("Entering Method DocumentUtil.getStringAsPDF(String string)");
    }
    com.itextpdf.text.Document docu = new com.itextpdf.text.Document();
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    PdfWriter.getInstance(docu, os);
    docu.open();
    Paragraph paragraph = new Paragraph();
    paragraph.setAlignment(Element.ALIGN_LEFT);
    paragraph.setFirstLineIndent(180);
    paragraph.add("\n"); //$NON-NLS-1$
    paragraph.add(string);
    paragraph.add("\n\n"); //$NON-NLS-1$
    docu.add(paragraph);

    docu.close();

    //Create an inputstream to return.
    return new ByteArrayInputStream(os.toByteArray());

}

From source file:com.photon.phresco.service.docs.impl.DocumentUtil.java

License:Apache License

private static void updateDoc(List<ModuleGroup> modules, com.itextpdf.text.Document docu, PdfWriter writer,
        String moduleName) throws DocumentException, PhrescoException, IOException {
    Paragraph para = new Paragraph();
    para.setAlignment(Element.ALIGN_CENTER);
    para.setFont(DocConstants.BODY_FONT);
    para.setFont(DocConstants.CATEGORY_FONT);
    para.add(moduleName);/*from  www  . j a  va 2  s .c o m*/
    addBlankLines(para, 2);
    docu.add(para);

    for (ModuleGroup tupleBean : modules) {
        para = new Paragraph();
        para.setFont(DocConstants.CATEGORY_FONT);
        para.add(tupleBean.getName());
        docu.add(para);
        Documentation document = tupleBean.getDoc(DocumentationType.DESCRIPTION);
        if (document != null) {
            if (!StringUtils.isEmpty(document.getUrl())) {
                PdfInput convertToPdf = DocConvertor.convertToPdf(document.getUrl());
                if (convertToPdf != null) {
                    DocumentUtil.addPages(convertToPdf.getInputStream(), writer, docu);
                }
            } else {
                para = new Paragraph();
                para.setFont(DocConstants.BODY_FONT);
                para.add(document.getContent());
                addBlankLines(para, 2);
                docu.add(para);
            }
        }
    }
}

From source file:com.photoshop.misc.Factuurgenerator.java

private void addTitlePage(Document document) throws DocumentException {
    Paragraph preface = new Paragraph();
    addEmptyLine(preface, 1);/* w  w  w. j a  v  a2 s.  co m*/

    Image Logo = null;
    try {
        Logo = Image.getInstance(env.getProperty("logo") + "Photoshop_black.png");
        Logo.scaleAbsolute(200, 100);
    } catch (BadElementException | IOException ex) {
        Logger.getLogger(OrderController.class.getName()).log(Level.SEVERE, null, ex);
    }
    SimpleDateFormat simpledatafo = new SimpleDateFormat("dd/MM/yyyy");
    preface.add(Logo);
    Paragraph datum = new Paragraph(this.Getspringmessage("Date") + ": " + simpledatafo.format(new Date()),
            smallBold);
    datum.setAlignment(Element.ALIGN_RIGHT);
    preface.add(datum);
    Paragraph Factuurnummer = new Paragraph(this.Getspringmessage("invoicenumber") + ": " + order.getId(),
            smallBold);
    Factuurnummer.setAlignment(Element.ALIGN_RIGHT);
    preface.add(Factuurnummer);
    addEmptyLine(preface, 1);

    //Aanmaken van de bedrijfs gegevens
    preface.add(new Paragraph(this.Getspringmessage("company"), subtitel));
    preface.add(new Paragraph("Rachelsmolen 1", subFont));
    preface.add(new Paragraph("5612MA Eindhoven", subFont)); //order nummer ingelezen worde
    preface.add(new Paragraph(this.Getspringmessage("accountNumber") + ": 165947888", subFont));
    preface.add(new Paragraph("Bank: Paypal", subFont));
    addEmptyLine(preface, 1);

    //Aanmaken van de bestellende persoons gegevens
    preface.add(new Paragraph(this.Getspringmessage("reciver") + ":", subtitel));
    preface.add(new Paragraph(order.getInvoiceaddress().getKlantnaam(), subFont)); //order nummer ingelezen worde
    preface.add(new Paragraph(order.getInvoiceaddress().getAdres(), subFont));
    preface.add(new Paragraph(
            order.getInvoiceaddress().getPostcode() + " " + order.getInvoiceaddress().getWoonplaats(),
            subFont));
    preface.add(new Paragraph(order.getInvoiceaddress().getTelefoonnummer(), subFont));
    addEmptyLine(preface, 1);

    //Aanmaken van de start zin 
    preface.add(new Paragraph(
            this.Getspringmessage("dear") + " " + order.getInvoiceaddress().getKlantnaam() + ",", subtitel));
    addEmptyLine(preface, 1);
    preface.add(new Paragraph(this.Getspringmessage("paymentvieuw"), subFont));
    addEmptyLine(preface, 1);
    //Aanmaken van de betaal tabel
    createTable(preface);
    //Overzicht bwt bedrag
    addEmptyLine(preface, 1);
    Paragraph btw = new Paragraph(this.Getspringmessage("taxamount") + ": " + " "
            + String.format("%.2f", (this.totaalprijs / 100) * 19), subFont);
    btw.setAlignment(Element.ALIGN_RIGHT);
    preface.add(btw);
    //Overzicht Totaalbedrag
    Paragraph Totaalbedrag = new Paragraph(
            this.Getspringmessage("totalamount") + ": " + " " + String.format("%.2f", this.totaalprijs),
            subtitel);
    Totaalbedrag.setAlignment(Element.ALIGN_RIGHT);
    preface.add(Totaalbedrag);
    addEmptyLine(preface, 1);

    //Toevoegen footerzin
    Paragraph footer = new Paragraph(this.Getspringmessage("invoicend"), subFont);
    footer.setAlignment(Element.ALIGN_CENTER);
    preface.add(footer);
    document.add(preface);
    Mailgenerator mail = new Mailgenerator();
    mail.Sendmail("willem1995@hotmail.com", order, env, filename);
}

From source file:com.photoshop.misc.Indexkaartgenerator.java

private void addTitlePage(Document document) throws DocumentException {
    document.newPage();/*from   w  ww.  j a  va2 s.  c  o  m*/
    Paragraph preface = new Paragraph();
    addEmptyLine(preface, 1);

    Image Logo = null;
    try {
        Logo = Image.getInstance(env.getProperty("logo") + "Photoshop_black.png");
        Logo.scaleAbsolute(200, 100);
    } catch (BadElementException | IOException ex) {
        Logger.getLogger(OrderController.class.getName()).log(Level.SEVERE, null, ex);
    }
    SimpleDateFormat simpledatafo = new SimpleDateFormat("dd/MM/yyyy");
    preface.add(Logo);
    Paragraph datum = new Paragraph(Getspringmessage("Date") + " " + simpledatafo.format(new Date()),
            smallBold);
    datum.setAlignment(Element.ALIGN_RIGHT);
    preface.add(datum);
    Paragraph Factuurnummer = new Paragraph(this.Getspringmessage("invoicenumber") + " " + order.getId(),
            smallBold);
    Factuurnummer.setAlignment(Element.ALIGN_RIGHT);
    preface.add(Factuurnummer);
    addEmptyLine(preface, 1);

    //Aanmaken van de bedrijfs gegevens
    preface.add(new Paragraph(this.Getspringmessage("company"), subtitel));
    preface.add(new Paragraph("Rachelsmolen 1", subFont));
    preface.add(new Paragraph("5612MA Eindhoven", subFont)); //order nummer ingelezen worde
    preface.add(new Paragraph(this.Getspringmessage("accountNumber") + ": 165947888", subFont));
    preface.add(new Paragraph("Bank: Paypal", subFont));
    addEmptyLine(preface, 1);

    //Aanmaken van de bestellende persoons gegevens
    preface.add(new Paragraph(this.Getspringmessage("reciver") + ": ", subtitel));
    preface.add(new Paragraph(order.getInvoiceaddress().getKlantnaam(), subFont)); //order nummer ingelezen worde
    preface.add(new Paragraph(order.getInvoiceaddress().getAdres(), subFont));
    preface.add(new Paragraph(
            order.getInvoiceaddress().getPostcode() + " " + order.getInvoiceaddress().getWoonplaats(),
            subFont));
    preface.add(new Paragraph(order.getInvoiceaddress().getTelefoonnummer(), subFont));
    addEmptyLine(preface, 1);

    //Aanmaken van de start zin 
    preface.add(new Paragraph(this.Getspringmessage("dear") + " " + order.getInvoiceaddress().getKlantnaam(),
            subtitel));
    addEmptyLine(preface, 1);
    preface.add(new Paragraph(
            this.Getspringmessage("allordersby") + " " + order.getInvoiceaddress().getKlantnaam(), subFont));
    addEmptyLine(preface, 1);
    //Aanmaken van de betaal tabel
    createTable(preface);

    //Toevoegen footerzin
    Paragraph footer = new Paragraph(this.Getspringmessage("thanksforordering"), subFont);
    footer.setAlignment(Element.ALIGN_CENTER);
    preface.add(footer);

    document.add(preface);

}

From source file:com.planfeed.services.MeetingServiceImpl.java

License:Apache License

public ByteArrayOutputStream getActa(String meetingId) throws Exception {
    Meeting meeting;//from   ww w.  j a  v  a 2s. c o  m
    try {
        meeting = this.getMeeting(meetingId);
    } catch (Exception e) {
        throw new MeetingNotFound();
    }

    Document document = new Document();
    ByteArrayOutputStream baosPDF = new ByteArrayOutputStream();
    PdfWriter docWriter = null;
    HeaderFooter event = new HeaderFooter(meeting.getDate());
    docWriter = PdfWriter.getInstance(document, baosPDF);
    docWriter.setBoxSize("art", new Rectangle(36, 54, 559, 788));
    docWriter.setPageEvent(event);
    document.open();

    //metadata
    document.addTitle(meeting.getTitle() + " Acta");

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

    //Title
    Paragraph title = new Paragraph("Acta of " + meeting.getTitle(), titleFont);
    title.setAlignment(Element.ALIGN_CENTER);

    addEmptyLine(title, 1);

    document.add(title);

    //Description
    Paragraph descriptionPar = new Paragraph();
    descriptionPar.add(new Paragraph("Description", titlePointFont));
    descriptionPar.add(new Paragraph(meeting.getDescription(), textFont));
    addEmptyLine(descriptionPar, 1);
    document.add(descriptionPar);

    //Points
    int index = 1;
    for (PointOfAgenda point : meeting.getAgenda()) {
        Paragraph pointPar = new Paragraph();
        pointPar.add(new Paragraph(index + ". " + point.getName(), titlePointFont));
        pointPar.add(new Paragraph(point.getComment(), textFont));
        addEmptyLine(pointPar, 2);
        document.add(pointPar);
        index += 1;
    }

    document.close();

    return baosPDF;

}

From source file:com.planning.project.controller.CreatePDF.java

/**
 * @param args//from ww  w. jav a2 s  .c  om
 * @throws Exception
 */
public static Document createPDFBudwork(String file, TbDescriptionstatement tbDescriptionstatement,
        List<TbAddmoneyvara> tbAddmoneyvaras, List<TbAddmoneynovara> tbAddmoneynovaras,
        List<TbRemunerationcommittee> tbRemunerationcommittees, List<TbMaketimeformeal> tbMaketimeformeals,
        List<TbRentshouse> tbRentshouses, List<TbTeachextra> tbTeachextras, List<TbExpenpaper> tbExpenpapers,
        List<TbComlecturer> tbComlecturers, List<TbOthercompensation> tbOthercompensations,
        List<TbAllowancesrental> tbAllowancesrentals, List<TbRepairofequipment> tbRepairofequipments,
        List<TbWageservice> tbWageservices, List<TbMeetingofthesnack> tbMeetingofthesnacks,
        List<TbSocialsecurity> tbSocialsecuritys, List<TbRentalproperty> tbRentalpropertys,
        List<TbThecertificationfood> tbThecertificationfoods,
        List<TbThecertificationdrink> tbThecertificationdrinks, List<TbThegift> tbThegifts, List<TbTax> tbTaxs,
        List<TbFee> tbFees, List<TbInsurance> tbInsurances, List<TbEmploy> tbEmploys,
        List<TbMaterial> tbMaterials1, List<TbMaterial> tbMaterials2, List<TbMaterial> tbMaterials3,
        List<TbMaterial> tbMaterials4, List<TbMaterial> tbMaterials5, List<TbMaterial> tbMaterials6,
        List<TbMaterial> tbMaterials7, List<TbMaterial> tbMaterials8, List<TbMaterial> tbMaterials9,
        List<TbMaterial> tbMaterials10, List<TbMaterial> tbMaterials11, List<TbPublicutility> tbPublicutilitys,
        List<TbGasolineDetail> tbGasolineDetails) throws Exception {

    Document document = null;

    try {
        Font font16 = new Font(
                BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
        font16.setSize(16);
        document = new Document();
        PdfWriter.getInstance(document, new FileOutputStream(file));
        document.open();
        Paragraph paragraph = new Paragraph();

        addMetaData(document);

        addTitlePageBud(document);

        createPagePDFBudwork(document, tbDescriptionstatement);

        createHeadlistBudwork(document, "1");

        PdfPTable table = createtableAddmoneyvara(tbAddmoneyvaras, tbDescriptionstatement.getSumAddmoneyvara());
        document.add(table);
        table.setSpacingBefore(25);

        table = createtableAddmoneynovara(tbAddmoneynovaras, tbDescriptionstatement.getSumAddmoneynovara());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableRemunerationcommittee(tbRemunerationcommittees,
                tbDescriptionstatement.getSumRemunerationcomnittee());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaketimeformeal(tbMaketimeformeals, tbDescriptionstatement.getSumMaketimeformeals());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableRentshouse(tbRentshouses, tbDescriptionstatement.getSumRentshouse());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableTeachextra(tbTeachextras, tbDescriptionstatement.getSumTeachextra());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableExpenpaper(tbExpenpapers, tbDescriptionstatement.getSumExpenpaper());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableComlecturer(tbComlecturers, tbDescriptionstatement.getSumComlecturer());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableOthercompensation(tbOthercompensations,
                tbDescriptionstatement.getSumOthercompensation());
        table.setSpacingBefore(25);
        document.add(table);

        createHeadlistBudwork(document, "2");

        table = createtableAllowancesrental(tbAllowancesrentals,
                tbDescriptionstatement.getSumAllowancesrental());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableGasolineDetail(tbGasolineDetails, tbDescriptionstatement.getSumGasoline());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableRepairofequipment(tbRepairofequipments,
                tbDescriptionstatement.getSumRepairofequipment());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableWageservice(tbWageservices, tbDescriptionstatement.getSumWageservice());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMeetingofthesnack(tbMeetingofthesnacks,
                tbDescriptionstatement.getSumMeetingofthesnack());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableSocialsecurity(tbSocialsecuritys, tbDescriptionstatement.getSumSocialsecurity());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableRentalproperty(tbRentalpropertys, tbDescriptionstatement.getSumRentalproperty());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableThecertificationfood(tbThecertificationfoods,
                tbDescriptionstatement.getSumThecertificationfood());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableThecertificationdrinks(tbThecertificationdrinks,
                tbDescriptionstatement.getSumThecertificationdrink());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableThegift(tbThegifts, tbDescriptionstatement.getSumThegift());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableTax(tbTaxs, tbDescriptionstatement.getSumTax());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableFee(tbFees, tbDescriptionstatement.getSumFee());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableInsurance(tbInsurances, tbDescriptionstatement.getSumInsurance());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableEmploy(tbEmploys, tbDescriptionstatement.getSumEmploy());
        table.setSpacingBefore(25);
        document.add(table);

        createHeadlistBudwork(document, "3");

        table = createtableMaterial1(tbMaterials1, tbDescriptionstatement.getSumMOffice());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial2(tbMaterials2, tbDescriptionstatement.getSumMBuild());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial3(tbMaterials3, tbDescriptionstatement.getSumMKitchen());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial4(tbMaterials4, tbDescriptionstatement.getSumMElectrical());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial5(tbMaterials5, tbDescriptionstatement.getSumMMedic());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial6(tbMaterials6, tbDescriptionstatement.getSumMStudy());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial7(tbMaterials7, tbDescriptionstatement.getSumMBook());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial8(tbMaterials8, tbDescriptionstatement.getSumMFarm());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial9(tbMaterials9, tbDescriptionstatement.getSumMCom());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial10(tbMaterials10, tbDescriptionstatement.getSumMMul());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial11(tbMaterials11, tbDescriptionstatement.getSumMOther());
        table.setSpacingBefore(25);
        document.add(table);

        createHeadlistBudwork(document, "4");

        table = createtablePublicutility(tbPublicutilitys, tbDescriptionstatement.getSumPublicutility());
        table.setSpacingBefore(25);
        document.add(table);

        document.close();
    } catch (FileNotFoundException e) {

        e.printStackTrace();
    } catch (DocumentException e) {
        e.printStackTrace();
    }
    return document;
}

From source file:com.planning.project.controller.CreatePDF.java

public static Document createPDFFormProject(String file, TbFormProject tbFormProject, List<TbActivity> activity,
        List<TbDetailSka> detailSka, List<TbDetailSm> detailSms, TbFormSubproject subProject,
        TbTargetgroup target) throws Exception {

    Document document = null;

    try {//w w  w  .ja va  2  s  .  c o m
        document = new Document();
        PdfWriter.getInstance(document, new FileOutputStream(file));
        document.open();

        addMetaData(document);

        addTitlePageProject(document);

        createPagePDFFormProject(document, tbFormProject, activity, detailSka, detailSms, subProject);

        PdfPTable table = createtableTargetGroup(target);
        document.add(table);
        table.setSpacingBefore(25);

        table = createtableTargetGroup2(target);
        table.setSpacingBefore(25);
        document.add(table);

        createPagePDFFormProject2(document, tbFormProject, activity, detailSka, detailSms, subProject);

        table = createtableFollowCheck(subProject);
        table.setSpacingBefore(25);
        document.add(table);

        table = createtablePro(tbFormProject);
        table.setSpacingBefore(25);
        document.add(table);

        createPagePDFFormProject3(document, tbFormProject, activity, detailSka, detailSms, subProject);

        document.close();

    } catch (FileNotFoundException e) {

        e.printStackTrace();
    } catch (DocumentException e) {
        e.printStackTrace();
    }
    return document;
}

From source file:com.planning.project.controller.CreatePDF.java

public static Document createPDFActivity(String file, Long activityId) throws Exception {

    Document document = null;

    try {/*from  ww w  .j  av  a  2s  . c  om*/
        document = new Document();
        PdfWriter.getInstance(document, new FileOutputStream(file));
        document.open();

        addMetaData(document);

        addTitlePageProject(document);

        Paragraph created = new Paragraph();
        created.setFont(TIME_ROMAN_SMALL);
        created.add(activityId.toString());
        created.setAlignment(Element.ALIGN_RIGHT);
        document.add(created);
        document.close();

    } catch (FileNotFoundException e) {

        e.printStackTrace();
    } catch (DocumentException e) {
        e.printStackTrace();
    }
    return document;
}

From source file:com.planning.project.controller.CreatePDF.java

private static void addTitlePage(Document document) throws DocumentException, IOException {

    Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
    font.setSize(24);/*from  ww w  .j  a v a 2 s  .  c o  m*/

    String imagepath = "src/main/webapp/resources/images/curt.gif";
    Image img = Image.getInstance(imagepath);
    img.scaleToFit(70f, 70f);

    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yyyy");

    Paragraph created = new Paragraph();
    created.setFont(TIME_ROMAN_SMALL);
    created.add("Report created on " + simpleDateFormat.format(new Date()));
    created.setAlignment(Element.ALIGN_RIGHT);

    Paragraph logo = new Paragraph();
    logo.setFont(TIME_ROMAN_SMALL);
    logo.add(img);
    logo.setAlignment(Element.ALIGN_LEFT);
    document.add(created);
    document.add(logo);

    // Paragraph created = new Paragraph();
    // created.setFont(TIME_ROMAN_SMALL);
    // created.add("Report created on " + simpleDateFormat.format(new
    // Date()));
    // created.setAlignment(Element.ALIGN_RIGHT);

    Paragraph paragraph = new Paragraph();
    paragraph.setFont(font);
    paragraph.add("FormProject ");

    paragraph.setAlignment(Element.ALIGN_CENTER);
    document.add(paragraph);
    creteEmptyLine(created, 1);

}

From source file:com.planning.project.controller.CreatePDF.java

private static void createTable(Document document) throws DocumentException, IOException {
    Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
    font.setSize(16);//from  ww  w  .j a v a  2  s  .co m

    Paragraph paragraph = new Paragraph();
    paragraph.setFont(font);
    creteEmptyLine(paragraph, 2);
    document.add(paragraph);
    PdfPTable table = new PdfPTable(7);

    paragraph.add("");

    PdfPCell c1 = new PdfPCell(new Phrase("asasas", font));

    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("/?", font));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("?", font));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    TbActivity ac = new TbActivity();

    c1 = new PdfPCell(new Phrase("", font));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("", font));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("", font));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("", font));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);
    table.setHeaderRows(1);

    paragraph.add("");

    for (int i = 0; i < 7; i++) {
        table.setWidthPercentage(100);
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
        table.addCell(paragraph);

    }

    document.add(table);
}