Example usage for com.itextpdf.text Document addCreationDate

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

Introduction

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

Prototype


public boolean addCreationDate() 

Source Link

Document

Adds the current date and time to a Document.

Usage

From source file:com.solidmaps.webapp.report.LicenseCivilIncludeProductPDF.java

License:Open Source License

private String createDocument(Document doc, PdfWriter docWriter, LicensePCEntity license, String type)
        throws FileNotFoundException, DocumentException {

    String fileName = "Requerimento de " + type + " Licensa: " + license.getCompany().getCnpj() + ".pdf";

    docWriter = PdfWriter.getInstance(doc, new FileOutputStream(filePath + fileName));

    // document header attributes
    doc.addAuthor("EnforceMaps");
    doc.addCreationDate();
    doc.addProducer();/* w  ww. j  a  v a  2 s . com*/
    doc.addCreator("EnforceMaps");
    doc.addTitle("Requerimento de " + type + " Licensa: " + license.getCompany().getCnpj());
    doc.setPageSize(PageSize.A4);

    // open document
    doc.open();

    return fileName;
}

From source file:com.solidmaps.webapp.report.MapCivilPdfGenerator.java

License:Open Source License

private String createDocument(Document doc, PdfWriter docWriter)
        throws FileNotFoundException, DocumentException {

    String fileName = "Mapa - " + company.getCnpj() + " - " + mapProduct.getNumTrimester() + " "
            + mapProduct.getYear() + ".pdf";

    docWriter = PdfWriter.getInstance(doc, new FileOutputStream(filePath + fileName));

    // document header attributes
    doc.addAuthor("EnforceMaps");
    doc.addCreationDate();
    doc.addProducer();/*from   w  w w  . java2s . c o m*/
    doc.addCreator("EnforceMaps");
    doc.addTitle("Mapa de Produtos Controlados: " + company.getCnpjFormatted());
    doc.setPageSize(PageSize.A4.rotate());

    // open document
    doc.open();

    return fileName;
}

From source file:com.solidmaps.webapp.report.MapExercitoPdfGenerator.java

License:Open Source License

private String createDocument(Document doc, PdfWriter docWriter)
        throws FileNotFoundException, DocumentException {

    String fileName = "Mapa - " + company.getCnpj() + " - " + mapProduct.getNumTrimester() + " "
            + mapProduct.getYear() + ".pdf";

    docWriter = PdfWriter.getInstance(doc, new FileOutputStream(filePath + fileName));

    // document header attributes
    doc.addAuthor("Solid Maps");
    doc.addCreationDate();
    doc.addProducer();/*from  w  w  w .  ja  v a2 s  .  c om*/
    doc.addCreator("solidmaps");
    doc.addTitle("Mapa de Produtos Controlados: " + company.getCnpjFormatted());
    doc.setPageSize(PageSize.A4.rotate());

    // open document
    doc.open();

    return fileName;
}

From source file:com.solidmaps.webapp.report.RenovationRequireExercitoPDF.java

private String createDocument(Document doc, PdfWriter docWriter, LicenseEXEntity license)
        throws FileNotFoundException, DocumentException {

    String fileName = "REQUERIMENTO PARA CONCESSO E REVALIDAO DE CERTIFICADO DE REGISTRO "
            + license.getNumRegister() + ".pdf";

    docWriter = PdfWriter.getInstance(doc, new FileOutputStream(filePath + fileName));

    // document header attributes
    doc.addAuthor("EnforceMaps");
    doc.addCreationDate();
    doc.addProducer();// ww w. j ava  2  s .c  o m
    doc.addCreator("EnforceMaps");
    doc.addTitle("REQUERIMENTO PARA CONCESSO E REVALIDAO DE CERTIFICADO DE REGISTRO "
            + license.getNumRegister() + ".pdf");
    doc.setPageSize(PageSize.A4);

    // open document
    doc.open();

    return fileName;
}

From source file:com.solidmaps.webapp.report.RequerimentAlterLicenseExercitoPDF.java

private String createDocument(Document doc, PdfWriter docWriter, LicenseEXEntity license)
        throws FileNotFoundException, DocumentException {

    String fileName = "REQUERIMENTO PARA APOSTILAMENTO DE CERTIFICADO DE REGISTRO " + license.getNumRegister()
            + ".pdf";

    docWriter = PdfWriter.getInstance(doc, new FileOutputStream(filePath + fileName));

    // document header attributes
    doc.addAuthor("EnforceMaps");
    doc.addCreationDate();
    doc.addProducer();//from   w  w w.  java2s. c  om
    doc.addCreator("EnforceMaps");
    doc.addTitle(
            "REQUERIMENTO PARA APOSTILAMENTO DE CERTIFICADO DE REGISTRO " + license.getNumRegister() + ".pdf");
    doc.setPageSize(PageSize.A4);

    // open document
    doc.open();

    return fileName;
}

From source file:com.solidmaps.webapp.report.RequerimentAlterLicenseFederalPDF.java

private String createDocument(Document doc, PdfWriter docWriter, LicensePFEntity license)
        throws FileNotFoundException, DocumentException {

    String fileName = "Comunicado de alterao cadastral - Cnpj: " + license.getCompany().getCnpj() + ".pdf";

    docWriter = PdfWriter.getInstance(doc, new FileOutputStream(filePath + fileName));

    // document header attributes
    doc.addAuthor("EnforceMaps");
    doc.addCreationDate();
    doc.addProducer();//www .  j  a  v  a2  s  .co  m
    doc.addCreator("EnforceMaps");
    doc.addTitle("Comunicado de alterao cadastral: ");
    doc.setPageSize(PageSize.A4);

    // open document
    doc.open();

    return fileName;
}

From source file:com.thomasmore.service.PdfCreateServiceImpl.java

public void readPdf() {
    try {/*w  w w . j  av a 2  s.  c  o  m*/
        OutputStream file = new FileOutputStream(new File("D:\\SamplePDFje.pdf"));

        Document document = new Document();
        PdfWriter.getInstance(document, file);

        document.open();
        document.add(new Paragraph("First iText PDF"));
        document.add(new Paragraph(new Date().toString()));

        document.addAuthor("Krishna Sfsfsfsn");
        document.addCreationDate();
        document.addCreator("JavaBeat");
        document.addTitle("Sample PDF");

        //Create Paragraph
        Paragraph paragraph = new Paragraph("Title 1", new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD));

        //New line
        paragraph.add(new Paragraph(" "));
        paragraph.add("Test Paragraph");
        paragraph.add(new Paragraph(" "));
        document.add(paragraph);

        //Create a table in PDF
        PdfPTable pdfTable = new PdfPTable(3);
        PdfPCell cell1 = new PdfPCell(new Phrase("Table Header 1"));
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        pdfTable.addCell(cell1);

        cell1 = new PdfPCell(new Phrase("Table Header 2"));
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        pdfTable.addCell(cell1);

        cell1 = new PdfPCell(new Phrase("Table Header 3"));
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        pdfTable.addCell(cell1);
        pdfTable.setHeaderRows(1);

        pdfTable.addCell("Row 1 Col 1");
        pdfTable.addCell("Row 1 Col 2");
        pdfTable.addCell("Row 1 Col 3");

        pdfTable.addCell("Row 2 Col 1");
        pdfTable.addCell("Row 2 Col 2");
        pdfTable.addCell("Row 2 Col 3");

        document.add(pdfTable);

        document.close();
        file.close();

    } catch (Exception e) {

        e.printStackTrace();
    }
}

From source file:com.unicauca.coordinacionpis.managedbean.RegistroFormatoAController.java

public void agregarMetadatos() {
    // create document and writer
    Document document = new Document(PageSize.A4);
    PdfWriter writer;/*ww w  .  j  av  a  2 s . c  o  m*/
    try {
        writer = PdfWriter.getInstance(document, new FileOutputStream("D:\\aguaabril2016.pdf"));
        // add meta-data to pdf
        document.addAuthor("Memorynotfound");
        document.addCreationDate();
        document.addCreator("Memorynotfound.com");
        document.addTitle("Add meta data to PDF");
        document.addSubject("how to add meta data to pdf using itext");
        document.addKeywords(metadatosAnteproyectos.getTitulo() + "," + metadatosAnteproyectos.getProfesor());
        document.addLanguage(Locale.ENGLISH.getLanguage());
        document.addHeader("type", "tutorial, example");

        // add xmp meta data
        writer.createXmpMetadata();

        document.open();
        document.add(new Paragraph("Add meta-data to PDF using iText"));
        document.close();
    } catch (FileNotFoundException ex) {
        Logger.getLogger(RegistroOfertaAcademicaController.class.getName()).log(Level.SEVERE, null, ex);
    } catch (DocumentException ex) {
        Logger.getLogger(RegistroOfertaAcademicaController.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:com.wipro.srs.service.PrintTicket.java

private static void addMetaData(Document document) {
    document.addTitle("Maverick Ship services ");
    document.addSubject("Ticket");
    document.addAuthor("Maverick Ship services");
    document.addCreator("Maverick Ship services");
    document.addCreationDate();
}

From source file:com.zentrix.minutas.SMinuta.java

/**
 * Handles the HTTP <code>POST</code> method.
 *
 * @param request servlet request/*from  w  w w  .jav a  2  s  . c  o m*/
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    //obtenemos los datos de la forma
    String titulo = request.getParameter("titulo");
    String cuerpo = request.getParameter("cuerpominuta");

    ServletOutputStream sos = response.getOutputStream();
    response.setContentType("application/pdf");
    //creamos un nuevo documento
    Document doc = new Document();

    //creamos los estilos y las fuentes
    Font bfBold20 = new Font(FontFamily.TIMES_ROMAN, 20, Font.BOLD, new BaseColor(0, 0, 0));
    Font bfBold12 = new Font(FontFamily.TIMES_ROMAN, 12, Font.BOLDITALIC, new BaseColor(0, 0, 0));
    Font bf12 = new Font(FontFamily.TIMES_ROMAN, 12);
    try {
        //creamos  un instancio de PdfWriter usando el OutputStream
        PdfWriter.getInstance(doc, sos);

        doc.addAuthor("Sistema Gestor de Academias");
        doc.addCreationDate();
        doc.addProducer();
        doc.addCreator("Sistema de Academias");
        doc.addTitle(titulo);
        doc.setPageSize(PageSize.LETTER);
        doc.open();
        doc.add(new Paragraph(titulo, bfBold20));
        doc.add(new Paragraph(cuerpo, bf12));
        doc.close();

        //        PrintWriter out = response.getWriter();
        //        out.println("titulo "+ titulo);
        //        out.println("cuerpo "+ cuerpo);
    } catch (DocumentException ex) {
        ex.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}