Example usage for com.itextpdf.text Document addAuthor

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

Introduction

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

Prototype


public boolean addAuthor(String author) 

Source Link

Document

Adds the author to a Document.

Usage

From source file:generadorPDF.generarPDF.java

private 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  w  ww .j  av a 2 s .  co  m

From source file:GUI.Carburant.java

private static void addMetaData(Document document) {
    document.addTitle("Carburant PDF");
    document.addSubject("subject");
    document.addKeywords("Car Fleet Management, PDF, JAVA");
    document.addAuthor("Marwen");
    document.addCreator("Marwen");
}

From source file:GUI.Cars.java

private static void addMetaData(Document document) {
    document.addTitle("Cars PDF");
    document.addSubject("subject");
    document.addKeywords("Car Fleet Management, PDF, JAVA");
    document.addAuthor("Marwen");
    document.addCreator("Marwen");
}

From source file:GUI.Fixings.java

private static void addMetaData(Document document) {
    document.addTitle("Fixing PDF");
    document.addSubject("subject");
    document.addKeywords("Car Fleet Management, PDF, JAVA");
    document.addAuthor("Marwen");
    document.addCreator("Marwen");
}

From source file:has.GenerateReceipt.java

private static void addMetaData(Document document) {
    document.addTitle("RECEPIT ");
    document.addSubject("Using iText");
    document.addKeywords("Java, PDF, iText");
    document.addAuthor("Kesava");
    document.addCreator("Kesava");
}

From source file:ics4u.ics4u_final_project.Recipe.java

License:Open Source License

private void addMetaData(Document doc) {
    //add all the meta data of the docmuent
    doc.addTitle(title);/*ww w .  ja  va2s .c o  m*/
    doc.addSubject("Recipies");
    doc.addKeywords("recipe, " + title);
    doc.addAuthor("Isaac Wismer");
    doc.addCreator("Nutrient Calculator. Made using the iTextPDF Library 5.5.8 http://itextpdf.com/");
}

From source file:info.sarihh.unimodeling.gui.DynamicBPEstimateFrame.java

public static void writeChartAsPDF(OutputStream out, JFreeChart chart, int width, int height, FontMapper mapper)
        throws IOException {
    Rectangle pagesize = new Rectangle(width, height);
    Document document = new Document(pagesize, 50, 50, 50, 50);
    try {/*from w  w  w . j  a  v a  2 s. c o  m*/
        PdfWriter writer = PdfWriter.getInstance(document, out);
        document.addAuthor("JFreeChart");
        document.addSubject("Demonstration");
        document.open();
        PdfContentByte cb = writer.getDirectContent();
        PdfTemplate tp = cb.createTemplate(width, height);
        Graphics2D g2 = tp.createGraphics(width, height, mapper);
        Rectangle2D r2D = new Rectangle2D.Double(0, 0, width, height);
        chart.draw(g2, r2D, null);
        g2.dispose();
        cb.addTemplate(tp, 0, 0);
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    }
    document.close();
}

From source file:info.toegepaste.www.service.ProjectServiceImpl.java

public void createPDFje(List<Score> scores) {
    try {//from ww w . j a va  2  s  .c om
        Document document = new Document();

        // Tijdelijk bestand aanmaken (PDF)
        File temp = File.createTempFile("resultaat", ".pdf");

        //PDF openen en bewerken
        PdfWriter.getInstance(document, new FileOutputStream(temp.getAbsolutePath()));
        document.open();

        // MetaData toevoegen
        document.addTitle("Resulaten");
        document.addAuthor("Score Tracker");
        document.addCreator("Score Tracker");

        // Titel toevoegen
        Paragraph preface = new Paragraph();
        preface.add(new Paragraph("Resultaten van de gekozen scores"));
        addEmptyLine(preface, 2);
        document.add(preface);

        // Tabel toevoegen met 5 kolommen
        PdfPTable table = new PdfPTable(5);

        PdfPCell c1 = new PdfPCell(new Phrase("Klas"));
        c1.setHorizontalAlignment(Element.ALIGN_LEFT);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Student"));
        c1.setHorizontalAlignment(Element.ALIGN_LEFT);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Vak"));
        c1.setHorizontalAlignment(Element.ALIGN_LEFT);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Test"));
        c1.setHorizontalAlignment(Element.ALIGN_LEFT);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Resultaat"));
        c1.setHorizontalAlignment(Element.ALIGN_LEFT);
        table.addCell(c1);
        table.setHeaderRows(1);

        //tabel opvullen met scores uit "List<Score> scores"
        for (Score score : scores) {
            table.addCell(score.getStudent().getKlas().getGroep());
            table.addCell(score.getStudent().getNaam());
            table.addCell(score.getTest().getVak().getNaam());
            table.addCell(score.getTest().getNaam());
            table.addCell(score.getPunt() + " / " + score.getTest().getMaxScore());
        }

        // breedte van de kolommen
        float[] columnWidths = new float[] { 10f, 25f, 20f, 20f, 15f };
        table.setWidths(columnWidths);

        document.add(table);

        document.close();

        // PDF downloaden
        exportPdf(temp);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:info.toegepaste.www.service.ProjectServiceImpl.java

public void createPDF(List<Score> scores) {
    try {/*from  w  ww .  j a va2  s  .c om*/
        Document document = new Document();

        // Tijdelijk bestand aanmaken (PDF)
        File temp = File.createTempFile("resultaat", ".pdf");

        //PDF openen en bewerken
        PdfWriter.getInstance(document, new FileOutputStream(temp.getAbsolutePath()));
        document.open();

        // MetaData toevoegen
        document.addTitle("Resulaten");
        document.addAuthor("Score Tracker");
        document.addCreator("Score Tracker");

        // Titel toevoegen
        Paragraph preface = new Paragraph();
        preface.add(new Paragraph("Resultaten van de gekozen scores"));
        addEmptyLine(preface, 2);
        document.add(preface);

        // Tabel toevoegen
        PdfPTable table = new PdfPTable(4);

        PdfPCell c1 = new PdfPCell(new Phrase("Student"));
        c1.setHorizontalAlignment(Element.ALIGN_LEFT);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Vak"));
        c1.setHorizontalAlignment(Element.ALIGN_LEFT);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Test"));
        c1.setHorizontalAlignment(Element.ALIGN_LEFT);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Resultaat"));
        c1.setHorizontalAlignment(Element.ALIGN_LEFT);
        table.addCell(c1);
        table.setHeaderRows(1);

        //tabel opvullen met scores uit "List<Score> scores"
        for (Score score : scores) {
            table.addCell(score.getStudent().getNaam());
            table.addCell(score.getTest().getVak().getNaam());
            table.addCell(score.getTest().getNaam());
            table.addCell(score.getPunt() + " / " + score.getTest().getMaxScore());
        }

        // breedte van de kolommen
        float[] columnWidths = new float[] { 10f, 25f, 20f, 20f, 15f };
        table.setWidths(columnWidths);

        document.add(table);

        document.close();

        // PDF downloaden
        exportPdf(temp);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Inventario.Inventario2.java

public void createDocument(String filename, String extension) throws DocumentException, FileNotFoundException {
        try {/*from   www . j ava2s  . c o m*/

            Document document = new Document(PageSize.LETTER, 50, 50, 85, 50);
            document.addAuthor("Inventario");
            document.addTitle("Reporte de Inventario Compra-Venta");

            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(RESULT));
            writer.setInitialLeading(16);
            Rectangle rct = new Rectangle(80, 104, 500, 688);
            writer.setBoxSize("art", rct);
            HeaderFooter event = new HeaderFooter();
            writer.setPageEvent(event);

            document.open();
            Paragraph parrafo2 = new Paragraph("Reportes de Inventario",
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.GRAY));
            parrafo2.setAlignment(0);
            document.add(parrafo2);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.add(Chunk.NEWLINE);
            document.close();
        } catch (Exception ex) {
            System.out.println(ex.getMessage());
        }
    }