Example usage for com.lowagie.text Document addTitle

List of usage examples for com.lowagie.text Document addTitle

Introduction

In this page you can find the example usage for com.lowagie.text Document addTitle.

Prototype


public boolean addTitle(String title) 

Source Link

Document

Adds the title to a Document.

Usage

From source file:com.qcadoo.mes.genealogiesForComponents.GenealogyForComponentView.java

License:Open Source License

@Override
protected void addTitle(final Document document, final Locale locale) {
    document.addTitle(translationService
            .translate("genealogiesForComponents.genealogyForComponent.report.title", locale));
}

From source file:com.qcadoo.mes.orders.print.OrderReportPdf.java

License:Open Source License

@Override
protected void addTitle(Document document, Locale locale) {
    document.addTitle(translationService.translate("orders.order.report.order", locale,
            orderEntity.getStringField(OrderFields.NUMBER)));
}

From source file:com.qcadoo.mes.qualityControls.print.QualityControlForBatchPdfView.java

License:Open Source License

@Override
protected final void addTitle(final Document document, final Locale locale) {
    document.addTitle(
            translationService.translate("qualityControls.qualityControlForBatch.report.title", locale));
}

From source file:com.qcadoo.mes.qualityControls.print.QualityControlForOperationPdfView.java

License:Open Source License

@Override
protected final void addTitle(final Document document, final Locale locale) {
    document.addTitle(
            translationService.translate("qualityControls.qualityControlForOperation.report.title", locale));
}

From source file:com.qcadoo.mes.qualityControls.print.QualityControlForOrderPdfView.java

License:Open Source License

@Override
protected final void addTitle(final Document document, final Locale locale) {
    document.addTitle(
            translationService.translate("qualityControls.qualityControlForOrder.report.title", locale));
}

From source file:com.qcadoo.mes.qualityControls.print.QualityControlForUnitPdfView.java

License:Open Source License

@Override
protected final void addTitle(final Document document, final Locale locale) {
    document.addTitle(
            translationService.translate("qualityControls.qualityControlForUnit.report.title", locale));
}

From source file:com.qcadoo.mes.technologies.print.TechnologiesTechnologyDetailsPdfView.java

License:Open Source License

@Override
protected final void addTitle(final Document document, final Locale locale) {
    document.addTitle(
            translationService.translate("technologies.technologiesTechnologyDetails.report.title", locale));
}

From source file:com.qcadoo.mes.warehouseMinimalState.print.DocumentPdf.java

License:Open Source License

@Override
protected void addTitle(Document document, Locale locale) {
    document.addTitle(translationService.translate("warehouseMinimalState.report.title", locale));
}

From source file:com.qcadoo.plugins.qcadooExport.internal.ExportToPDFController.java

License:Open Source License

@Monitorable(threshold = 500)
@ResponseBody/*from   w w w.  j a  v a 2 s .co m*/
@RequestMapping(value = { CONTROLLER_PATH }, method = RequestMethod.POST)
public Object generatePdf(@PathVariable(PLUGIN_IDENTIFIER_VARIABLE) final String pluginIdentifier,
        @PathVariable(VIEW_NAME_VARIABLE) final String viewName, @RequestBody final JSONObject body,
        final Locale locale) {
    try {
        changeMaxResults(body);
        ViewDefinitionState state = crudService.invokeEvent(pluginIdentifier, viewName, body, locale);
        GridComponent grid = (GridComponent) state.getComponentByReference("grid");
        Document document = new Document(PageSize.A4.rotate());
        String date = DateFormat.getDateInstance().format(new Date());
        File file = fileService.createExportFile("export_" + grid.getName() + "_" + date + ".pdf");
        FileOutputStream fileOutputStream = new FileOutputStream(file);
        PdfWriter writer = PdfWriter.getInstance(document, fileOutputStream);

        writer.setPageEvent(new PdfPageNumbering(footerResolver.resolveFooter(locale)));

        document.setMargins(40, 40, 60, 60);

        document.addTitle("export.pdf");
        pdfHelper.addMetaData(document);
        writer.createXmpMetadata();
        document.open();

        String title = translationService.translate(
                pluginIdentifier + "." + viewName + ".window.mainTab." + grid.getName() + ".header", locale);

        Date generationDate = new Date();

        pdfHelper.addDocumentHeader(document, "", title,
                translationService.translate("qcadooReport.commons.generatedBy.label", locale), generationDate);

        int columns = 0;
        List<String> exportToPDFTableHeader = new ArrayList<String>();
        for (String name : grid.getColumnNames().values()) {
            exportToPDFTableHeader.add(name);
            columns++;
        }
        PdfPTable table = pdfHelper.createTableWithHeader(columns, exportToPDFTableHeader, false);

        List<Map<String, String>> rows;
        if (grid.getSelectedEntitiesIds().isEmpty()) {
            rows = grid.getColumnValuesOfAllRecords();
        } else {
            rows = grid.getColumnValuesOfSelectedRecords();
        }

        for (Map<String, String> row : rows) {
            for (String value : row.values()) {
                table.addCell(new Phrase(value, FontUtils.getDejavuRegular7Dark()));
            }
        }
        document.add(table);
        document.close();

        state.redirectTo(fileService.getUrl(file.getAbsolutePath()) + "?clean", true, false);
        return crudService.renderView(state);
    } catch (JSONException e) {
        throw new IllegalStateException(e.getMessage(), e);
    } catch (FileNotFoundException e) {
        throw new IllegalStateException(e.getMessage(), e);
    } catch (DocumentException e) {
        throw new IllegalStateException(e.getMessage(), e);
    }
}

From source file:com.qcadoo.report.api.pdf.PdfDocumentService.java

License:Open Source License

protected void buildPdfMetadata(final Document document, final Locale locale) {
    document.addTitle(getReportTitle(locale));
    pdfHelper.addMetaData(document);//from  w w w  .j a  va2  s. c o  m
}