Example usage for com.lowagie.text Document addKeywords

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

Introduction

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

Prototype


public boolean addKeywords(String keywords) 

Source Link

Document

Adds the keywords to a Document.

Usage

From source file:com.qcadoo.report.internal.PdfHelperImpl.java

License:Open Source License

@Override
public void addMetaData(final Document document) {
    document.addSubject("Using iText");
    document.addKeywords("Java, PDF, iText");
    document.addAuthor("QCADOO");
    document.addCreator("QCADOO");
}

From source file:Cotizacion.ExportarPDF.java

private static void agregarMetaDatos(Document document) {
    document.addTitle("PDF Cliente");
    document.addSubject("Usando iText");
    document.addKeywords("Java, PDF, iText");
    document.addAuthor("Ana Karen Soto");
    document.addCreator("Ana Karen Soto");
}

From source file:de.dhbw.humbuch.util.PDFHandler.java

/**
 * Adds meta data to the PDF document. The information of using iText must
 * be part of the meta data due to the license of the iText library!
 * /*from ww w  . j a v a2  s .  com*/
 * @param document
 *            represents the PDF before it is saved
 */
private void addMetaData(Document document) {
    document.addTitle("Humbuch Schule");
    document.addSubject("Using iText");
    document.addKeywords("Java, PDF, iText");
    document.addAuthor("Schlager");
    document.addCreator("Schlager");
}

From source file:de.jdufner.sudoku.generator.pdf.PdfPrinterImpl.java

License:Open Source License

private Document writeDocument(Document document, List<SudokuData> sudokus) throws DocumentException {
    document.open();/*w  ww .  j  a  v a 2 s .c  o  m*/
    // TODO Von auen konfigurieren
    document.addAuthor("Jrgen Dufner");
    document.addCreationDate();
    document.addCreator("de.jdufner.sudoku.Generator");
    document.addKeywords("Sudoku");
    document.addTitle("Sudokus in unterschiedlichen Schwierigkeitsgraden");
    document.add(writePdfMetaTable(sudokus));
    document.close();
    return document;
}

From source file:de.unigoettingen.sub.commons.contentlib.pdflib.PDFManager.java

License:Apache License

/***************************************************************************
 * Creates a PDF, which is streams to the OutputStream out.
 * //from   w  w  w. j  a va 2s .  c  om
 * @param out {@link OutputStream}
 * @param pagesizemode {@link PdfPageSize}
 * 
 * 
 * @throws IOException Signals that an I/O exception has occurred.
 * @throws FileNotFoundException the file not found exception
 * @throws ImageManagerException the image manager exception
 * @throws PDFManagerException the PDF manager exception
 * @throws ImageInterpreterException the image interpreter exception
 * @throws URISyntaxException
 ****************************************************************************/
public void createPDF(OutputStream out, PdfPageSize pagesizemode, Watermark myWatermark)
        throws ImageManagerException, FileNotFoundException, IOException, PDFManagerException,
        ImageInterpreterException, URISyntaxException {

    Document pdfdoc = null;
    PdfWriter writer = null;

    Rectangle pagesize = null; // pagesize of the first page
    PdfPageLabels pagelabels = null; // object to store all page labels

    try {
        if ((imageURLs == null) || (imageURLs.isEmpty())) {
            throw new PDFManagerException("No URLs for images available, HashMap is null or empty");
        }

        // set the page sizes & pdf document
        pdfdoc = setPDFPageSizeForFirstPage(pagesizemode, pagesize);

        // writer for creating the PDF
        writer = createPDFWriter(out, pdfdoc);

        // set metadata for PDF as author and title
        // ------------------------------------------------------------------------------------
        if (this.title != null) {
            pdfdoc.addTitle(this.title);
        }
        if (this.author != null) {
            pdfdoc.addAuthor(this.author);
        }
        if (this.keyword != null) {
            pdfdoc.addKeywords(this.keyword);
        }
        if (this.subject != null) {
            pdfdoc.addSubject(this.subject);
        }
        // add title page to PDF
        if (pdftitlepage != null) {
            // create a title page
            pdftitlepage.render(pdfdoc);
        }

        // iterate over all files, they must be ordered by the key
        // the key contains the page number (as integer), the String
        // contains the Page name
        // ----------------------------------------------------------------------

        pagelabels = addAllPages(pagesizemode, writer, pdfdoc, myWatermark);

        // add page labels
        if (pagelabels != null) {
            writer.setPageLabels(pagelabels);
        }

        // create the required xmp metadata
        // for pdfa
        if (pdfa) {
            writer.createXmpMetadata();
        }
    } catch (ImageManagerException e) {
        if (pdfdoc != null) {
            pdfdoc.close();
        }
        if (writer != null) {
            writer.close();
        }
        throw e;
    } catch (PDFManagerException e) {
        if (pdfdoc != null) {
            pdfdoc.close();
        }
        if (writer != null) {
            writer.close();
        }
        throw e;
    } catch (ImageInterpreterException e) {
        if (pdfdoc != null) {
            pdfdoc.close();
        }
        if (writer != null) {
            writer.close();
        }
        throw e;
    } catch (IOException e) {
        if (pdfdoc != null) {
            pdfdoc.close();
        }
        if (writer != null) {
            writer.close();
        }
        throw e;
    }
    // close documents and writer
    try {
        if (pdfdoc != null && pdfdoc.isOpen()) {
            pdfdoc.close();
        }
        if (writer != null) {
            writer.close();
        }
    } catch (IllegalStateException e) {
        LOGGER.warn("Caught IllegalStateException when closing pdf document.");
    } catch (NullPointerException e) {
        throw new PDFManagerException("Nullpointer occured while closing pdfwriter");
    }
    LOGGER.debug("PDF document and writer closed");
}

From source file:es.uniovi.asw.personalletter.PDFTextWritter.java

/**
 * Metadata del documento.//from  w w w .j a v  a 2  s.c o m
 * @param document Documento en cuestin
 */
private void addMetaData(Document document) {
    document.addTitle("My first PDF");
    document.addSubject("Using iText");
    document.addKeywords("Java, PDF, iText");
    document.addAuthor("Lars Vogel");
    document.addCreator("Lars Vogel");
}

From source file:it.govpay.web.console.pagamenti.gde.exporter.PdfExporter.java

License:Open Source License

private static void addMetaData(Document document) {
    document.addTitle("Report Eventi");
    document.addSubject("Report Eventi selezionati nella console Govpay");
    document.addKeywords("Report, Eventi, Govpay");
    document.addAuthor("Govpay");
    document.addCreator("Govpay");
}

From source file:mesquite.lib.MesquitePDFFile.java

License:Open Source License

/**
 *@arg document Document object representing the output file
 * Add metadata to the PDF fle//  www  .j av a  2 s.co  m
 */
private void addMetaData(Document document) {
    document.addCreator(
            "Mesquite " + MesquiteModule.getMesquiteVersion() + " using portions of " + document.getVersion());
    try {
        String uname = System.getProperty("user.name");
        document.addAuthor(uname);
    } catch (SecurityException e) {
        document.addAuthor("Unknown");
    }
    document.addKeywords("Mesquite"); // more later
    //document.addTitle(this.component.getParent().getName());  // ToDo: get the window's actual title 
}

From source file:org.gbif.ipt.task.Eml2Rtf.java

License:Apache License

/**
 * Construct RTF document, mainly out of information extracted from Resource's EML object. Currently, the decision
 * has been made to always do this in English.
 * /*from ww w. ja  v  a  2 s  . c o  m*/
 * @param doc Document
 * @param resource Resource
 * @throws DocumentException if problem occurs during add
 */
public void writeEmlIntoRtf(Document doc, Resource resource, String lng) throws DocumentException {
    // initialising resourceBundle.
    Locale loc = new Locale(lng);
    resourceBundle = ResourceBundle.getBundle("ApplicationResources", loc);
    // this.action = action;
    Eml eml = resource.getEml();
    // configure page
    doc.setMargins(72, 72, 72, 72);
    System.out.println(DataDir.CONFIG_DIR);
    // write metadata
    doc.addAuthor(resource.getCreator().getName());
    doc.addCreationDate();
    doc.addTitle((eml.getTitle() == null) ? resource.getShortname() : eml.getTitle());
    // add the keywords to the document
    StringBuilder keys = new StringBuilder();
    for (KeywordSet kw : eml.getKeywords()) {
        if (keys.length() == 0) {
            keys.append(kw.getKeywordsString(", "));
        } else {
            keys.append(", " + kw.getKeywordsString(", "));
        }
    }
    String keysValue = keys.toString();
    doc.addKeywords(keysValue);
    // write proper doc
    doc.open();
    // title
    addPara(doc, eml.getTitle(), fontHeader, 0, Element.ALIGN_CENTER);
    doc.add(Chunk.NEWLINE);
    // Authors, affiliations and corresponging authors
    addAuthors(doc, eml);
    // Other various sections..
    addDates(doc);
    //addCitations(doc);
    // Section called "Resource Citation" above "Abstract"
    addResourceCitation(doc, eml);
    setResAbs(eml);
    setPalKey(keysValue);
    setDisAgr(eml);
    //addAbstract(doc, eml);
    addRes(doc);
    //addKeywords(doc, keysValue);
    addPalcla(doc);
    addAbs(doc);
    addKeyWord(doc);
    addGeneralDescription(doc, eml);
    addProjectData(doc, eml);
    //addResourceLink(doc, resource);
    addTaxonomicCoverages(doc, eml, loc);
    addSpatialCoverage(doc, eml);
    addTemporalCoverages(doc, eml, loc);
    addNaturalCollections(doc, eml);
    addMethods(doc, eml);
    addResul(doc);
    addDatasetDescriptions(doc, resource);
    //addMetadataDescriptions(doc, eml);
    addDiscu(doc);
    addAgrad(doc);
    addReferences(doc, eml);
    doc.close();
}

From source file:org.inbio.modeling.core.manager.impl.ExportManagerImpl.java

License:Open Source License

private void addMetadata(Document d) {

    // Add metadata
    d.addTitle(this.getI18nString("pdfReport.metadataTitle"));
    d.addSubject(this.getI18nString("pdfReport.metadataSubject"));
    d.addKeywords(this.getI18nString("pdfReport.metadataKeywords"));
    d.addCreator(this.getI18nString("pdfReport.metadataCreator"));
}