Example usage for com.itextpdf.text Document addKeywords

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

Introduction

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

Prototype


public boolean addKeywords(String keywords) 

Source Link

Document

Adds the keywords to a Document.

Usage

From source file:CTD.planer2.util.ExportToPdf.java

/**
 * add meta information to pdf file// ww w  . j a  v a  2  s  .co  m
 * 
 * @param document
 */
private static void addMetaData(Document document) {
    document.addTitle(" ");
    document.addSubject("Using iText PDF, licensed under AGPL");
    document.addKeywords(" ");
    document.addAuthor(" ");
    document.addCreator(" ");
}

From source file:digilib.pdf.PDFStreamWorker.java

License:Open Source License

/**
 * Set PDF-Meta-Attributes./*from   ww  w . ja v a 2s  .  c  om*/
 */
public Document setPDFProperties(Document doc) {
    // TODO get proper Information from dlConfig
    doc.addAuthor(this.getClass().getName());
    doc.addCreationDate();
    doc.addKeywords("digilib");
    doc.addTitle("digilib PDF");
    doc.addCreator(this.getClass().getName());
    return doc;
}

From source file:Documentos.ReportesPDF.java

private static void agregarMetaDatos(Document document) {
    document.addTitle("Reporte de Ventas");
    document.addSubject("Repostera AnaIs");
    document.addKeywords("Line by Line");
    document.addAuthor("Line by Line");
}

From source file:DomainToolCore.Report.PDFSubDomains.java

License:Open Source License

private static void addMetaData(Document document) {
    document.addTitle("Domain Tool Report");
    document.addSubject("site: " + domain);
    document.addKeywords("Domain, Tool, PDF, ip, address");
    document.addAuthor("Domain Tool");
    document.addCreator("Domain Tool");
}

From source file:ECS.create.java

create() {
    //geting the file path from Page.
    String dpath = Page.dpath;/*w w  w.j  a v  a  2 s  .c  om*/
    try {
        //define program "information" as data
        information data = new information();

        //crate a PDF File
        Document cs = new Document();
        //locate where the PDF save.
        FileOutputStream local = new FileOutputStream(dpath);
        //New PDF location
        PdfWriter writer = PdfWriter.getInstance(cs, local);

        //Edit Propety of the PDF
        cs.addTitle("Title@CoverSheet");
        cs.addAuthor("Author@rensanning");
        cs.addSubject("Subject@iText sample");
        cs.addKeywords("Keywords@iText");
        cs.addCreator("Creator@iText");

        //Seting the Font of the text in the PDF
        Font title = new Font(Font.FontFamily.HELVETICA, 25, Font.BOLD);
        //Font stitle = new Font(Font.FontFamily.COURIER, 18,Font.ITALIC | Font.UNDERLINE);
        Font stitle = new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD);
        Font usual = new Font(Font.FontFamily.TIMES_ROMAN, 18);

        // open the PDF File
        cs.open();

        PdfContentByte canvas = writer.getDirectContent();

        // insert the information in the PDF
        //group the information into paragrph
        Paragraph sinfo = new Paragraph();
        //using the data form the database which geting by program "information"
        sinfo.add(new Chunk("Name: " + data.fn + " " + data.ln, title));
        //cs.add(Chunk.NEWLINE);
        sinfo.add(new Chunk("               "));
        sinfo.add(new Chunk("SID: " + data.sid, title));
        sinfo.setLeading(40);
        //sinfo.add(Chunk.NEWLINE);
        cs.add(sinfo);

        Paragraph cinfo = new Paragraph();
        cinfo.add(new Chunk("Course: " + data.cid + "   " + data.cn, stitle));
        cinfo.setLeading(30);
        cinfo.add(Chunk.NEWLINE);
        cs.add(cinfo);

        Paragraph minfo = new Paragraph();
        minfo.add(new Chunk("Module: ", stitle));
        minfo.add(new Chunk(data.mid + " " + data.mn, usual));
        minfo.setLeading(30);
        minfo.add(Chunk.NEWLINE);
        cs.add(minfo);

        // insert the information in the PDF
        Paragraph cwinfo = new Paragraph();
        cwinfo.add(new Chunk("Coursework ID: ", stitle));
        cwinfo.add(new Chunk(data.cwid, usual));
        cwinfo.add(Chunk.NEWLINE);
        cwinfo.add(new Chunk("Coursework Tile: ", stitle));
        cwinfo.add(new Chunk(data.cwt, usual));
        cwinfo.add(Chunk.NEWLINE);
        cwinfo.add(new Chunk("Coursework Deadline is on ", stitle));
        cwinfo.add(new Chunk(data.cwed, usual));
        cwinfo.setLeading(30);
        cs.add(cwinfo);

        cs.add(new Paragraph("Rule: \n" + " I am the Boss", usual));

        //Phrase phrase1= new Phrase("This is sentence 1. ", title);
        //ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, phrase1, 30, 600, 0); 
        //cs.add(new Paragraph("Name: " + data.fn + " " + data.ln, title));
        //cs.add(new Chunk("SID: " + data.sid));

        //Close the PDF file
        cs.close();
    } catch (DocumentException | FileNotFoundException ex) {
        System.out.println(ex);
    }
}

From source file:edu.avans.ivh5.shared.util.generateInvoicePDF.java

private static void addMetaData(Document document) {
    document.addTitle("My first PDF");
    document.addSubject("Using iText");
    document.addKeywords("Java, PDF, iText");
    document.addAuthor("Oguzhan Babaarslan");
    document.addCreator("Oguzhan Babaarslan");
}

From source file:edu.bedelias.utils.ReportsService.java

/**
 * Adds metadata info to the generated file. This info can be viewed in under File -> Properties
 * /*  w  w  w  .  ja v a2  s  .co  m*/
 * @param title
 *            file title
 * @param author
 *            name of the author
 * @param subject
 *            { metadata }
 * @param keywords
 *            { metadata, comma-separated values }
 * @param creator
 *            { metadata, file creator }
 * @param document
 *            file to be modified
 */
private static void addMetaData(String title, String author, String subject, String keywords, String creator,
        Document document) {

    if (title == null || title.isEmpty()) {
        document.addTitle(PDF_TITLE);
    }

    if (subject == null || subject.isEmpty()) {
        document.addSubject(PDF_SUBJECT);
    }

    if (keywords == null || keywords.isEmpty()) {
        document.addKeywords(PDF_KEYWORDS);
    }

    if (author == null || author.isEmpty()) {
        document.addAuthor(PDF_AUTHOR);
    }

    if (creator == null || creator.isEmpty())
        document.addCreator(PDF_AUTHOR);
}

From source file:edu.cornell.mannlib.vitro.webapp.visualization.visutils.PDFDocument.java

License:Open Source License

public PDFDocument(String authorName, Map<String, Integer> yearToPublicationCount, Document document,
        PdfWriter pdfWriter) {//from w  w w. ja va  2  s. c om

    //        setPreferredSize(new Dimension(600,400));

    try {

        document.addTitle("PDF Pipeline iText Prototype");
        document.addAuthor(authorName);
        document.addSubject("This example tests text, color, image, transparency & table functionality.");
        document.addKeywords("text, color, image, transparency, table");
        document.addCreator("Standalone PDF Renderer using iText");

        Paragraph header = new Paragraph();

        Font pageHeaderStyle = FontFactory.getFont(FontFactory.TIMES_ROMAN, 15,
                Font.BOLDITALIC | Font.UNDERLINE);
        Font featureHeaderStyle = FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, new BaseColor(Color.red));

        header.add(new Chunk("PDF Pipeline Prototype v2 using iText\n", pageHeaderStyle));

        header.setSpacingAfter(15f);

        document.add(header);

        Paragraph content = new Paragraph();

        content.add(new Chunk("Publication Count - Author Name - " + authorName, featureHeaderStyle));

        content.setSpacingAfter(15f);

        document.add(content);
        // step4

        PdfPTable publicationCount = createTable(yearToPublicationCount);

        document.add(publicationCount);

        content = new Paragraph();

        content.add(new Chunk("Transparency of Shapes", featureHeaderStyle));

        content.setSpacingAfter(15f);

        document.add(content);

        createTransparencyShapes(document, pdfWriter);

        createImage(document, pdfWriter, featureHeaderStyle);

    } catch (DocumentException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

From source file:edu.esprit.pi.gui.internalframes.PDFwithItextInternalFrame.java

public void addMetaData(Document document) {
    document.addTitle(titrePDFjTextField.getText());
    document.addSubject(subjectjTextField.getText());
    document.addKeywords(keywordjTextField.getText());
    document.addAuthor(autheurjTextField.getText());
    document.addCreator(creatorjTextField.getText());
}

From source file:edu.ucue.jparking.srv.ExportOrdenPagoService.java

private void addMetaData(Document document) {
    document.addTitle("Orden de pago");
    document.addSubject("Using iText");
    document.addKeywords("Java, PDF, iText");
    document.addAuthor("Lara-Santos");
    document.addCreator("Lara-Santos");
}