List of usage examples for com.itextpdf.text Document addTitle
public boolean addTitle(String title)
From source file:com.sarav.donormgmttool.SendMail.java
public void writePdf(OutputStream outputStream, float ramount, java.sql.Date rdate, int rnum, String rname, String rmode) throws Exception { Document document = new Document(); //step2 http://developers.itextpdf.com/examples/xml-worker-itext5/html-tables PdfWriter writer = PdfWriter.getInstance(document, outputStream); String PDFContent = "<center>\n" + " <table style=\"text-align:center\">\n" + " <tr>\n" + " <td>\n" + " <img src=\"Images/Small - Team Everest Logo.png\"> \n" + " </td>\n" + " <td>\n" + " <h1 style=\"font-family: Arial\"><b><u>Team Everest</u></b></h1><b>(Regd No: 2292/09)</b>\n" + " <p style=\"font-family: Times\"> 5/1B, Magaveerar Street, Arnipalayam, Arni 632301<br>\n" + " Tiruvannamalai Dt, Tamilnadu, India Phone: +91 89399 12365<br>\n" + " Email: info@teameverestindia.org Website: www.teameverestindia.org</p>\n" + " </td>\n" + " </tr>\n" + " <tr><td><br><br><br><br></td></tr>\n" + " <tr>\n" + " <td>\n" + " <b>Reciept No:</b>*********\n" + " </td>\n" + " <td>\n" + " \n" + " </td>\n" + " <td>\n" + " <b>Date:</b>********\n" + " </td>\n" + " </tr>\n" + " <tr><td><br><br><br><br></td></tr>\n" + " <tr>\n" + " <td></td>\n" + " <td>\n" + " <p style=\"font-family: Times\">Received the sum of Rs. <b>*****/- (*******)</b>, with thanks from\n" + " <b>*******</b> as donation for Team Everest.</p>\n" + " </td>\n" + " </tr>\n" + " <tr><td><br><br><br><br></td></tr>\n" + " <tr>\n" + " <td></td>\n" + " <td>\n" + " <p style=\"text-align:left\"><b>Amount:</b> Rs.******** <b>Mode of Donation:</b>********</p>\n" + " </td>\n" + " </tr>\n" + " <tr><td><br><br><br><br></td></tr>\n" + " <tr><td><br><br><br><br></td>\n" + " <td style=\"text-align:right\">\n" + " <p>For Team Everest </p>\n" + " <img src =\"Images/Signature.JPG\">\n" + " </td>\n" + " </tr>\n" + " <tr><td><br><br><br><br></td></tr>\n" + " <tr>\n" + " <td></td>\n" + " <td>\n" + " <p>*Donations are exempted under 80G of Income Tax Act<br>\n" + " 1961 C, No. DIT (E) No. 2 (19) 1011. Pan No: AABTT6850G.</p>\n" + " </td>\n" + " </tr>\n" + " </table>\n" + " </center>"; document.open();/*from w ww . ja v a 2s . co m*/ document.addTitle("EReceipt"); document.addSubject("EreceiptPDF"); document.addKeywords("iText, email"); document.addAuthor("AKSarav"); document.addCreator("AkSarav"); //HTMLWorker htmlworker = new HTMLWorker(document); StringBuilder contentBuilder = new StringBuilder(); Paragraph paragraph = new Paragraph(); //System.out.println("PDFCONTENT"+PDFContent); contentBuilder.append(PDFContent); //HTML Processor HtmlPipelineContext htmlContext = new HtmlPipelineContext(null); htmlContext.setTagFactory(Tags.getHtmlTagProcessorFactory()); // Pipelines PdfWriterPipeline pdf = new PdfWriterPipeline(document, writer); HtmlPipeline html = new HtmlPipeline(htmlContext, pdf); //XMLWorker XMLWorker worker = new XMLWorker(html, true); XMLParser p = new XMLParser(worker); p.parse(new ByteArrayInputStream(contentBuilder.toString().getBytes())); // Closing the document document.close(); }
From source file:com.shashi.itext.write.FirstPdf.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 source file:com.skatettoo.reportes.Generador.java
public String generarPDF() throws Exception { try {//from w w w .ja va 2 s.c o m String path = FacesContext.getCurrentInstance().getExternalContext().getRealPath("img"); path = path.substring(0, path.indexOf("\\build")); path = path + "\\web\\img\\"; Document doc = new Document(PageSize.A4, 36, 36, 10, 10); PdfPTable tabla = new PdfPTable(4); PdfWriter.getInstance(doc, new FileOutputStream(path + "\\archivo\\reporte.pdf\\")); doc.open(); Image img = Image.getInstance(path + "Skatetoo4.png"); img.scaleAbsolute(40, 40); img.setAlignment(Element.ALIGN_LEFT); doc.add(img); doc.addTitle(this.titulo); doc.addAuthor("\n "); doc.addAuthor("\n "); doc.addAuthor("\n "); doc.addAuthor("\n "); tabla.setWidthPercentage(100); tabla.setWidths(new float[] { 1.4f, 0.8f, 0.8f, 0.8f }); Object font = new Font(Font.FontFamily.HELVETICA, 14, Font.BOLD, BaseColor.WHITE); PdfPCell cell = new PdfPCell(new Phrase("Reporte de tatuadores", (Font) font)); cell.setColspan(4); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setPaddingTop(0f); cell.setPaddingBottom(7f); cell.setBackgroundColor(new BaseColor(0, 0, 0)); cell.setBorder(0); cell.setBorderWidthBottom(2f); tabla.addCell(cell); tabla.addCell("Tatuador"); tabla.addCell("Cantidad de diseos"); tabla.addCell("Citas realizadas"); tabla.addCell("Noticias publicadas"); for (Usuario u : this.getUsu()) { tabla.addCell(u.getNombre() + " " + u.getApellido()); tabla.addCell(String.valueOf(u.getDisenioList().size())); tabla.addCell(String.valueOf(u.getCitaList1().size())); tabla.addCell(String.valueOf(u.getNoticiaList().size())); } doc.add(tabla); doc.bottomMargin(); /* doc.add(new Paragraph("Tatuador mas solicitado")); for(Usuario u : this.getUs()){ doc.add(new Paragraph(u.getNombre() + " " + u.getApellido())); }*/ doc.close(); FacesContext context = FacesContext.getCurrentInstance(); ExternalContext externalContext = context.getExternalContext(); externalContext.responseReset(); externalContext.setResponseContentType("application/pdf"); externalContext.setResponseHeader("Content-Disposition", "attachment;filename=\"reporte.pdf\""); FileInputStream inputStream = new FileInputStream(new File(path + "\\archivo\\reporte.pdf\\")); OutputStream outputStream = externalContext.getResponseOutputStream(); byte[] buffer = new byte[1024]; int length; while ((length = inputStream.read(buffer)) > 0) { outputStream.write(buffer, 0, length); } inputStream.close(); context.responseComplete(); } catch (Exception e) { throw e; } return ""; }
From source file:com.softwaremagico.tm.pdf.complete.PdfDocument.java
License:Open Source License
protected Document addMetaData(Document document) { document.addTitle("Fading Suns Character Sheet"); document.addAuthor("Software Magico"); document.addCreator("Think Machine"); document.addSubject("RPG"); document.addKeywords("RPG, Fading Suns, FS, " + language); document.addCreationDate();//from w w w . j ava 2 s . co m return document; }
From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java
private String createDocument(Document doc, PdfWriter docWriter, LicensePFEntity license) throws FileNotFoundException, DocumentException { String fileName = "Requerimento de Habilitao de PJ - Cnpj: " + license.getCompany().getCnpj() + ".pdf"; docWriter = PdfWriter.getInstance(doc, new FileOutputStream(filePath + fileName)); // document header attributes doc.addAuthor("EnforceMaps"); doc.addCreationDate();/*from w w w . j a v a 2 s . c o m*/ doc.addProducer(); doc.addCreator("EnforceMaps"); doc.addTitle("Requerimento de Habilitao de PJ"); doc.setPageSize(PageSize.A4); // open document doc.open(); return fileName; }
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();/*from ww w . ja v a2 s . c o m*/ doc.addProducer(); 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();// ww w. ja v a 2 s. c om doc.addProducer(); 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();//w w w . ja va2s . c om doc.addProducer(); 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();// ww w .j a v a 2 s.c o m doc.addProducer(); 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();/*from ww w . j av a 2 s. c o m*/ doc.addProducer(); 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; }