List of usage examples for com.itextpdf.text Document addHeader
public boolean addHeader(String name, String content)
From source file:org.zaproxy.zap.extension.alertReport.AlertReportExportPDF.java
License:Apache License
private static void addTitlePage(Document document, ExtensionAlertReportExport extensionExport) throws DocumentException { document.addHeader("Header1", "Header2"); Paragraph preface = new Paragraph(); // We add one empty line addEmptyLine(preface, 3);//from ww w . ja v a 2s . c o m // add logo first page addImage(preface, extensionExport.getParams().getLogoFileName(), 40f); addEmptyLine(preface, 4); // Lets write a big header Paragraph paragraph = new Paragraph(extensionExport.getParams().getTitleReport(), titleFont); paragraph.setAlignment(Paragraph.ALIGN_CENTER); preface.add(paragraph); addEmptyLine(preface, 3); paragraph = new Paragraph(extensionExport.getParams().getCustomerName(), catFont); paragraph.setAlignment(Paragraph.ALIGN_CENTER); preface.add(paragraph); addEmptyLine(preface, 15); preface.add(new Paragraph( extensionExport.getMessages().getString("alertreport.export.message.export.pdf.confidential"), smallBold)); preface.add(new Paragraph(extensionExport.getParams().getConfidentialText(), litleFont)); document.add(preface); // Start a new page document.newPage(); }
From source file:qedit.export.PDFObject.java
License:GNU General Public License
public void publish(OutputStream stream) throws Exception { if (stream == null) { throw new NullPointerException("Cannot public pdf to a null output stream"); }// w w w . j a v a2 s. co m try { /* * Initialize the document... */ Document doc = new Document(); try { PdfWriter.getInstance(doc, stream); } catch (ClassCastException ex) { throw new ClassCastException("The stream you provided is not a valid output stream"); } doc.open(); /* * Meta-information about the document... */ doc.addAuthor(pdfAuthor); doc.addCreationDate(); doc.addProducer(); doc.addSubject(subject); doc.addCreator(pdfCreator); doc.addTitle(pdfTitle); doc.addKeywords(pdfKeywords); doc.addHeader("License", "GNU GPL v3"); doc.add(new Paragraph("\n\n\n")); for (Element e : elements) { doc.add(e); } doc.close(); } catch (DocumentException ex) { throw new DocumentException("Error while generating PDF representation."); } }
From source file:ufc.fbd.modelo.GeradorPdf.java
public GeradorPdf(Aluga aluga) { Document document = new Document(); try {//from w w w . j a v a 2 s . c o m PdfWriter.getInstance(document, new FileOutputStream("C://pdfsGerados/notaFiscal.pdf")); document.open(); document.addHeader("Nota Fiscal", "Cliente: " + aluga.getCliente().getNome() + " Cpf: " + aluga.getCliente().getCpf()); document.top(5.0f); document.add(new Paragraph("Nota Fiscal, Locadora: " + aluga.getFilme().getLocadora().getNome() + ", " + aluga.getCliente().getLocadora().getNome() + " " + aluga.getData())); document.add(new Paragraph(" ")); document.add(new Paragraph("Cliente: " + aluga.getCliente().getNome())); document.add(new Paragraph("Cpf: " + aluga.getCliente().getCpf())); document.add(new Paragraph(" ")); document.add(new Paragraph("Nome do Filme: " + aluga.getFilme().getNome())); document.add(new Paragraph("Categoria: " + aluga.getFilme().getCategoria().getCategoria())); document.add(new Paragraph("Indicao: " + aluga.getFilme().getIndicacao())); document.add(new Paragraph(" ")); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } document.close(); }