Example usage for com.itextpdf.text Document close

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

Introduction

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

Prototype

boolean close

To view the source code for com.itextpdf.text Document close.

Click Source Link

Document

Has the document already been closed?

Usage

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

License:Apache License

/**
 * Process tuple beans to generate Documnets for a speific entity type.
 * @param dependencyManager dependency manager
 * @param modules list of tuple beans//from w w  w  . ja  v a 2 s .co m
 * @param type Entity type
 * @return PDF input stream.
 * @throws PhrescoException
 */
public static InputStream getDocumentStream(List<ArtifactGroup> modules) throws PhrescoException {
    if (isDebugEnabled) {
        S_LOGGER.debug(
                "Entering Method DocumentUtil.getDocumentStream(RepositoryManager repoManager,List<TupleBean> modules, EntityType type)");
    }
    try {
        if (CollectionUtils.isNotEmpty(modules)) {
            com.itextpdf.text.Document docu = new com.itextpdf.text.Document();
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            PdfWriter writer = PdfWriter.getInstance(docu, os);
            docu.open();
            List<ArtifactGroup> coreModules = new ArrayList<ArtifactGroup>();
            List<ArtifactGroup> externalModules = new ArrayList<ArtifactGroup>();
            List<ArtifactGroup> jsLibraries = new ArrayList<ArtifactGroup>();
            List<ArtifactGroup> components = new ArrayList<ArtifactGroup>();
            for (ArtifactGroup artifactGroup : modules) {
                if (artifactGroup.getType().name().equals(Type.FEATURE.name())) {
                    if (artifactGroup.getAppliesTo().get(0).isCore() == true) {
                        coreModules.add(artifactGroup);
                    } else {
                        externalModules.add(artifactGroup);
                    }
                } else if (artifactGroup.getType().name().equals(Type.JAVASCRIPT.name())) {
                    jsLibraries.add(artifactGroup);
                } else if (artifactGroup.getType().name().equals(Type.COMPONENT.name())) {
                    components.add(artifactGroup);
                }
            }

            if (CollectionUtils.isNotEmpty(coreModules)) {
                updateDoc(coreModules, docu, writer, coreModule);
            }
            if (CollectionUtils.isNotEmpty(externalModules)) {
                updateDoc(externalModules, docu, writer, externalModule);
            }
            if (CollectionUtils.isNotEmpty(jsLibraries)) {
                updateDoc(jsLibraries, docu, writer, "JsLibraries");
            }
            if (CollectionUtils.isNotEmpty(components)) {
                updateDoc(components, docu, writer, "Components");
            }
            docu.close();

            return new ByteArrayInputStream(os.toByteArray());
        }
    } catch (DocumentException e) {
        e.printStackTrace();
        throw new PhrescoException(e);
    }
    return null;
}

From source file:com.photon.phresco.framework.impl.DocumentGeneratorImpl.java

License:Apache License

@Override
public void generate(ApplicationInfo info, File filePath, List<ArtifactGroup> artifacts,
        ServiceManager serviceManager) throws PhrescoException {
    if (isDebugEnabled) {
        S_LOGGER.debug("Entering Method DocumentGeneratorImpl.generate(ProjectInfo info, File filePath)");
    }//from w  ww  .  ja  v a2  s  . c om
    OutputStream os = null, fos = null;
    try {
        if (isDebugEnabled) {
            S_LOGGER.debug("generate() Filepath=" + filePath.getPath());
        }
        String folderPath = filePath.toString() + File.separator + "docs";
        File docsFolder = new File(folderPath);
        if (!docsFolder.exists()) {
            docsFolder.mkdirs();
        }
        if (isDebugEnabled) {
            S_LOGGER.debug("generate() ProjectCode=" + info.getCode());
        }
        String path = folderPath + File.separator + info.getAppDirName() + "_doc.pdf";
        os = new FileOutputStream(new File(path));

        com.itextpdf.text.Document docu = new com.itextpdf.text.Document();

        PdfCopy pdfCopy = new PdfCopy(docu, os);
        docu.open();
        InputStream titleSection = DocumentUtil.getTitleSection(info);
        DocumentUtil.addPages(titleSection, pdfCopy);
        String techId = info.getTechInfo().getId();
        Technology technology = serviceManager.getTechnology(techId);
        if (StringUtils.isNotEmpty(technology.getDescription())) {
            InputStream stringAsPDF = DocumentUtil.getStringAsPDF(technology.getDescription());
            DocumentUtil.addPages(stringAsPDF, pdfCopy);
        }

        //         if (StringUtils.isNotEmpty(technology.getDescription())) {
        //            PdfInput convertToPdf = DocConvertor.convertToPdf(technology
        //                  .getDescription());
        //            if (convertToPdf != null) {
        //               DocumentUtil.addPages(convertToPdf.getInputStream(),
        //                     pdfCopy);
        //            }
        //         } else {
        //         }

        if (CollectionUtils.isNotEmpty(artifacts)) {
            for (ArtifactGroup artifactGroup : artifacts) {
                ArtifactElement artifactDescription = serviceManager
                        .getArtifactDescription(artifactGroup.getId());
                if (artifactDescription != null) {
                    artifactGroup.setDescription(artifactDescription.getDescription());
                }
            }
            DocumentUtil.addPages(artifacts, pdfCopy);
        }

        docu.close();

        //generate index.html
        String indexHtml = DocumentUtil.getIndexHtml(docsFolder);
        File indexPath = new File(docsFolder, "index.html");
        fos = new FileOutputStream(indexPath);
        fos.write(indexHtml.getBytes());
    } catch (IOException e) {
        e.printStackTrace();
        if (isDebugEnabled) {
            S_LOGGER.debug("(The process cannot access the file because it is being used by another process");
        }
        throw new PhrescoException(e);
    } catch (com.itextpdf.text.DocumentException e) {
        e.printStackTrace();
        if (isDebugEnabled) {
            S_LOGGER.debug("(The process cannot access the file because it is being used by another process");
        }
        throw new PhrescoException(e);
    } finally {
        Utility.closeStream(os);
        Utility.closeStream(fos);
    }
}

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

License:Apache License

/**
 * Adds title section.//from   w  w  w . j  av  a2s  . com
 * @param info the project info object
 * @return PDF input stream
 * @throws DocumentException
 */
public static InputStream getTitleSection(ProjectInfo info) throws DocumentException {
    if (isDebugEnabled) {
        S_LOGGER.debug(" Entering Method DocumentUtil.getTitleSection(ProjectInfo info)");
    }
    if (isDebugEnabled) {
        S_LOGGER.debug("getTitleSection() projectCode=" + info.getCode());
    }
    //create output stream
    com.itextpdf.text.Document docu = new com.itextpdf.text.Document();
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    PdfWriter.getInstance(docu, os);
    docu.open();

    //add standard title section with supplied info object
    Paragraph paragraph = new Paragraph();
    paragraph.setAlignment(Element.ALIGN_CENTER);
    paragraph.setFont(DocConstants.TITLE_FONT);
    addBlankLines(paragraph, 10);
    paragraph.add(info.getName());
    addBlankLines(paragraph, 4);
    docu.add(paragraph);

    paragraph = new Paragraph();
    paragraph.setAlignment(Element.ALIGN_CENTER);
    addBlankLines(paragraph, 10);
    String techName = info.getTechnology().getName();
    if (info.getTechnology().getVersions() != null) {
        paragraph.add(techName + " - " + info.getTechnology().getVersions().get(0));
    } else {
        paragraph.add(techName);
    }
    docu.add(paragraph);

    paragraph = new Paragraph();
    addBlankLines(paragraph, 10);
    paragraph.setAlignment(Element.ALIGN_CENTER);
    paragraph.add(DocumentMessages.getString("Documents.version.name") + getVersion(info)); //$NON-NLS-1$
    addBlankLines(paragraph, 7);
    docu.add(paragraph);
    paragraph = new Paragraph();
    paragraph.setAlignment(Element.ALIGN_RIGHT);
    paragraph.setFont(DocConstants.DESC_FONT);
    paragraph.setFirstLineIndent(8);
    paragraph.add(info.getDescription());
    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

/**
 * 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  a  va 2s. c o  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

/**
 * Process tuple beans to generate Documnets for a speific entity type.
 * @param dependencyManager dependency manager
 * @param modules list of tuple beans//from  www .j  a v  a 2 s  .  co  m
 * @param type Entity type
 * @return PDF input stream.
 * @throws PhrescoException
 * @throws DocumentException
 * @throws IOException
 */
public static InputStream getDocumentStream(List<ModuleGroup> modules, String moduleType)
        throws PhrescoException, DocumentException, IOException {
    if (isDebugEnabled) {
        S_LOGGER.debug(
                "Entering Method DocumentUtil.getDocumentStream(RepositoryManager repoManager,List<TupleBean> modules, EntityType type)");
    }
    if (modules != null && !modules.isEmpty()) {
        com.itextpdf.text.Document docu = new com.itextpdf.text.Document();
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        PdfWriter writer = PdfWriter.getInstance(docu, os);
        docu.open();
        if (moduleType.equals("Modules")) {
            List<ModuleGroup> coreModules = new ArrayList<ModuleGroup>();
            List<ModuleGroup> externalModules = new ArrayList<ModuleGroup>();
            for (ModuleGroup moduleGroup : modules) {
                if (moduleGroup.isCore()) {
                    coreModules.add(moduleGroup);
                }
                if (!moduleGroup.isCore()) {
                    externalModules.add(moduleGroup);
                }
            }
            if (coreModules != null && CollectionUtils.isNotEmpty(coreModules)
                    && moduleType.equals("Modules")) {
                updateDoc(coreModules, docu, writer, coreModule);
            }
            if (externalModules != null && CollectionUtils.isNotEmpty(externalModules)
                    && moduleType.equals("Modules")) {
                updateDoc(externalModules, docu, writer, externalModule);
            }
        }
        if (moduleType.equals("JsLibraries")) {
            updateDoc(modules, docu, writer, moduleType);
        }
        docu.close();

        return new ByteArrayInputStream(os.toByteArray());
    }
    return null;
}

From source file:com.photon.phresco.service.impl.DocumentGeneratorImpl.java

License:Apache License

@Override
public void generate(ProjectInfo info, File filePath) throws PhrescoException {
    if (isDebugEnabled) {
        S_LOGGER.debug("Entering Method DocumentGeneratorImpl.generate(ProjectInfo info, File filePath)");
    }// w  w  w  .j  a  v  a2  s  .  c  o m
    OutputStream os = null, fos = null;

    try {
        if (isDebugEnabled) {
            S_LOGGER.debug("generate() Filepath=" + filePath.getPath());
        }
        String folderPath = filePath.toString() + File.separator + "docs";
        File docsFolder = new File(folderPath);
        if (!docsFolder.exists()) {
            docsFolder.mkdirs();
        }
        if (isDebugEnabled) {
            S_LOGGER.debug("generate() ProjectCode=" + info.getCode());
        }
        String path = folderPath + File.separator + info.getName() + "_doc.pdf";
        os = new FileOutputStream(new File(path));

        com.itextpdf.text.Document docu = new com.itextpdf.text.Document();

        PdfCopy pdfCopy = new PdfCopy(docu, os);
        docu.open();
        InputStream titleSection = DocumentUtil.getTitleSection(info);
        DocumentUtil.addPages(titleSection, pdfCopy);

        Technology technology = PhrescoServerFactory.getDbManager()
                .getTechnologyDoc(info.getTechnology().getId());
        List<Documentation> technologyDoc = technology.getDocs();
        if (technologyDoc != null) {
            for (Documentation documentation : technologyDoc) {
                if (!StringUtils.isEmpty(documentation.getUrl())) {
                    PdfInput convertToPdf = DocConvertor.convertToPdf(documentation.getUrl());
                    if (convertToPdf != null) {
                        DocumentUtil.addPages(convertToPdf.getInputStream(), pdfCopy);
                    }
                } else {
                    InputStream stringAsPDF = DocumentUtil.getStringAsPDF(documentation.getContent());
                    DocumentUtil.addPages(stringAsPDF, pdfCopy);
                }
            }
        }

        //            Documents documentInfo = repoManager.getDocument(technology.getId(), EntityType.TECHNOLOGY);
        //            if(documentInfo!= null){
        //                List<Document> docs = documentInfo.getDocument();
        //                for (Document document : docs) {
        //                    if(!StringUtils.isEmpty(document.getUrl())){
        //                        PdfInput convertToPdf = DocConvertor.convertToPdf(document.getUrl());
        //                        if(convertToPdf != null) {
        //                            DocumentUtil.addPages(convertToPdf.getInputStream(), pdfCopy);
        //                        }
        //                    } else {
        //                        InputStream stringAsPDF = DocumentUtil.getStringAsPDF(document.getContent());
        //                        DocumentUtil.addPages(stringAsPDF, pdfCopy);
        //                    }
        //                }
        //            }

        List<ModuleGroup> tuples = technology.getModules();
        DocumentUtil.addPages(tuples, pdfCopy, MODULES);

        List<ModuleGroup> libraries = technology.getJsLibraries();
        DocumentUtil.addPages(libraries, pdfCopy, LIB);
        //TODO: need to do for App servers, databases if required.

        docu.close();

        //generate index.html
        String indexHtml = DocumentUtil.getIndexHtml(docsFolder);
        File indexPath = new File(docsFolder, "index.html");
        fos = new FileOutputStream(indexPath);
        fos.write(indexHtml.getBytes());
    } catch (IOException e) {
        if (isDebugEnabled) {
            S_LOGGER.debug("(The process cannot access the file because it is being used by another process");
        }
        throw new PhrescoException(e);
    } catch (com.itextpdf.text.DocumentException e) {
        if (isDebugEnabled) {
            S_LOGGER.debug("(The process cannot access the file because it is being used by another process");
        }
        throw new PhrescoException(e);
    } finally {
        Utility.closeStream(os);
        Utility.closeStream(fos);
    }
}

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

public Factuurgenerator(Order order, Environment env, MessageSource messageSource, Locale locale) {
    this.locale = locale;
    this.messageSource = messageSource;
    this.env = env;
    this.order = order;
    this.filename = "Factuur " + order.getId();
    String FILE = env.getProperty("logo") + this.filename + ".pdf"; //order generate moet nog gemaakt worden
    catFont = new Font(Font.FontFamily.HELVETICA, 18, Font.BOLD);
    subtitel = new Font(Font.FontFamily.HELVETICA, 14, Font.BOLD);
    subFont = new Font(Font.FontFamily.HELVETICA, 12, Font.NORMAL);
    smallBold = new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD);

    try {/*from   ww w . ja  va2  s. c  o m*/
        Document document = new Document();
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(FILE));
        document.open();
        document.newPage();
        addMetaData(document);
        addTitlePage(document);
        //addContent(document);
        document.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

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

public Indexkaartgenerator(Order order, Environment env, PhotoDao photoDao, MessageSource messageSource,
        Locale locale) {/*from  w  w w . ja v  a  2 s . c  om*/
    this.photoDao = photoDao;
    this.env = env;
    this.order = order;
    this.messageSource = messageSource;
    this.locale = locale;
    this.filename = "Indexkaart " + order.getId();
    String filename = "Indexkaart " + order.getId();
    String FILE = env.getProperty("logo") + filename + ".pdf"; //order generate moet nog gemaakt worden
    catFont = new Font(Font.FontFamily.HELVETICA, 18, Font.BOLD);
    subtitel = new Font(Font.FontFamily.HELVETICA, 14, Font.BOLD);
    subFont = new Font(Font.FontFamily.HELVETICA, 12, Font.NORMAL);
    smallBold = new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD);

    try {
        Document document = new Document();
        PdfWriter.getInstance(document, new FileOutputStream(FILE));
        document.open();
        addMetaData(document);
        addTitlePage(document);
        //addContent(document);
        document.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

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

License:Apache License

public ByteArrayOutputStream getActa(String meetingId) throws Exception {
    Meeting meeting;//from  w  ww. j a  va2 s  .  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/*w  ww.  j av a 2s . 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;
}