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:com.ainfosec.macresponse.report.PdfGenerator.java

License:Open Source License

private static void addMetaData(String caseName, String authorName, Document document) {
    document.addTitle(caseName);//from w  w w.  j a  v  a2s  .c o m
    document.addSubject("MacResponse Console");
    document.addKeywords("");
    document.addAuthor(authorName);
    document.addCreator(System.getProperty("user.name"));
}

From source file:com.auskeny.ems.print.PdfCreator.java

public static 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:com.debashubham.dumpy.ChainageCalcActivity.java

private void addMetaData(Document document) {
    document.addTitle("Report generated on:" + formattedDate);
    document.addSubject("Dumpy Level Report");
    document.addKeywords("Dumpy Level, PDF");
    document.addAuthor("Dumpy");
    document.addCreator("Dumpy");
}

From source file:com.docdoku.server.extras.TitleBlockGenerator.java

License:Open Source License

protected void addMetaData(Document document) {
    document.addTitle(title);//from w w  w .  j av  a  2  s. co  m
    document.addSubject(subject);
    document.addKeywords(keywords);
    document.addAuthor(authorName);
    document.addCreator(authorName);
}

From source file:com.example.drivequickstart.PDFActivity.java

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:com.github.albfernandez.joinpdf.JoinPdf.java

License:Open Source License

private void setParametersAndHeaders(final PdfWriter writer, final Document document) throws DocumentException {
    if (this.extraCompression) {
        writer.setFullCompression();//  w  w w.  j ava 2 s  . c om
    }
    if (this.isCrypt() && bouncyCastleLoaded) {
        int permisos = PdfWriter.ALLOW_PRINTING;
        writer.setEncryption(null, null, permisos, PdfWriter.ENCRYPTION_AES_128);
    }
    if (!StringUtils.isBlank(this.getMetadataAuthor())) {
        document.addAuthor(this.getMetadataAuthor());
    }
    if (!StringUtils.isBlank(this.getMetadataKeywords())) {
        document.addKeywords(this.getMetadataKeywords());
    }
    if (!StringUtils.isBlank(this.getMetadataTitle())) {
        document.addTitle(this.getMetadataTitle());
    }
    if (!StringUtils.isBlank(this.getMetadataSubject())) {
        document.addSubject(this.getMetadataSubject());
    }
}

From source file:com.mobicage.rogerthat.enterprise.samples.hr.bizz.GenerateExpenseNote.java

License:Open Source License

public int handle(final User user, final User manager, final ExpenseNote en)
        throws MalformedURLException, IOException, DocumentException {

    log.info("Building list of expenses ...");
    List<Expense> expenses = Expense.list(en);
    log.info("Retrieved " + expenses.size() + " expenses from the datastore");

    log.info("Creating ExpenseNoteDocOutputStream");
    ExpenseNoteDocOutputStream stream = new ExpenseNoteDocOutputStream(en);

    Document document = new Document();
    PdfWriter.getInstance(document, stream);
    document.open();/*  w  w  w  .ja  va 2 s.  co  m*/

    document.addTitle("Expense note " + en.id + " of " + user.name);
    document.addSubject("Expense note generated by Rogerthat Enterprise!");
    document.addKeywords("expense note");
    document.addAuthor(user.name);
    document.addCreator("Rogerthat OneApp Enterprise Mobility");

    Paragraph preface = new Paragraph();

    preface.add(new Paragraph("TP Vision expense note", titleFont));
    preface.add(new Paragraph(" "));

    DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
    Date date = new Date();
    preface.add(new Paragraph("Date: " + dateFormat.format(date)));
    preface.add(new Paragraph("Requestor: " + user.name));
    preface.add(new Paragraph("Approver: " + manager.name));
    preface.add(new Paragraph(" "));

    PdfPTable table = new PdfPTable(7);
    table.setWidthPercentage(110);
    table.setWidths(new int[] { 5, 15, 15, 35, 10, 15, 10 });
    addHeader(table, "Id");
    addHeader(table, "Date");
    addHeader(table, "Nature");
    addHeader(table, "Description");
    addHeader(table, "Account");
    addHeader(table, "Amount");
    addHeader(table, "Voucher");
    table.setHeaderRows(1);

    Collections.sort(expenses, new Comparator<Expense>() {
        @Override
        public int compare(Expense e1, Expense e2) {
            return (int) (e1.date - e2.date);
        }
    });
    int i = 0;
    double total = 0;
    for (Expense expense : expenses) {
        PdfPCell c1 = new PdfPCell(new Phrase("" + ++i));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(c1);
        table.addCell(dateFormat.format(new Date(expense.date * 1000)));
        table.addCell(expense.nature);
        table.addCell(expense.description);
        table.addCell("" + expense.account);
        c1 = new PdfPCell(new Phrase(DECIMAL_FORMAT.format(expense.amount) + " " + expense.currency));
        c1.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(c1);
        table.addCell(expense.voucher);
        total += expense.amount;
    }

    preface.add(table);

    preface.add(new Paragraph(" "));
    preface.add(new Paragraph("Total: " + DECIMAL_FORMAT.format(total), titleFont));

    document.add(preface);

    i = 0;
    for (Expense expense : expenses) {
        i++;
        if (expense.receipt == null)
            continue;

        document.newPage();
        Paragraph receipt = new Paragraph();
        receipt.add(new Paragraph("Attachment " + i, titleFont));
        document.add(receipt);
        Image image = Image.getInstance(new URL(expense.receipt));
        image.setRotationDegrees(-90);
        float scaler = (document.getPageSize().getWidth() / image.getWidth()) * 100;

        image.scalePercent(scaler);
        document.add(image);
    }

    document.close();
    stream.close();

    return stream.getSize();

}

From source file:com.mstoyanov.music_lessons.pdf.CreatePDF.java

License:Open Source License

private static void addMetaData(Document document) {
    document.addTitle("Music School");
    document.addSubject("Music Lessons Weekly Schedule");
    document.addKeywords("Piano, Music Theory, Lessons");
    document.addAuthor(name);//from   w  w  w. j a  v a2s  .  com
    document.addCreator("Created with iTextG under the APGL");
}

From source file:com.mycompany.mavenproject2.VirtualkeyController.java

private static void addMetaData(Document document) {
    document.addTitle("Item");
    document.addSubject("Item History ");
    document.addKeywords("Item, History, POS");
    document.addAuthor("Store Name");
    document.addCreator("Germanium Inc.");
}

From source file:com.sarav.donormgmttool.EmailWithPdf.java

/**
 * Writes the content of a PDF file (using iText API)
 * to the {@link OutputStream}.//from ww w .  ja  v a2s . co  m
 * @param outputStream {@link OutputStream}.
 * @throws Exception
 */
public void writePdf(OutputStream outputStream) throws Exception {
    Document document = new Document();
    PdfWriter.getInstance(document, outputStream);

    document.open();

    document.addTitle("Test PDF");
    document.addSubject("Testing email PDF");
    document.addKeywords("iText, email");
    document.addAuthor("Jee Vang");
    document.addCreator("Jee Vang");

    Paragraph paragraph = new Paragraph();
    paragraph.add(new Chunk("hello!"));
    document.add(paragraph);

    document.close();
}