private void createWriter(Document document, String title) throws DocumentException, IOException { final PdfWriter writer = PdfWriter.getInstance(document, output); //writer.setViewerPreferences(PdfWriter.PageLayoutTwoColumnLeft); // title final HeaderFooter header = new HeaderFooter(new Phrase(title), false); header.setAlignment(Element.ALIGN_LEFT); header.setBorder(Rectangle.NO_BORDER); document.setHeader(header); // simple page numbers : x //HeaderFooter footer = new HeaderFooter(new Phrase(), true); //footer.setAlignment(Element.ALIGN_RIGHT); //footer.setBorder(Rectangle.TOP); //document.setFooter(footer); // add the event handler for advanced page numbers : x/y writer.setPageEvent(new PdfAdvancedPageNumberEvents()); }
/** * Constructs a <CODE>Header</CODE>-object with a pagenumber at the end. * * @param before the <CODE>Phrase</CODE> before the pagenumber * @param numbered <CODE>true</CODE> if the page has to be numbered */ public HeaderFooter(Phrase before, boolean numbered) { super(0, 0, 0, 0); setBorder(TOP + BOTTOM); setBorderWidth(1); this.numbered = numbered; this.before = before; }
/** * Constructs a <CODE>Header</CODE>-object with a pagenumber at the end. * * @param before the <CODE>Phrase</CODE> before the pagenumber * @param numbered <CODE>true</CODE> if the page has to be numbered */ public HeaderFooter(Phrase before, boolean numbered) { super(0, 0, 0, 0); setBorder(TOP + BOTTOM); setBorderWidth(1); this.numbered = numbered; this.before = before; }
HeaderFooter header = new HeaderFooter(new Phrase("HBOM Reports"), false); header.setAlignment(HeaderFooter.ALIGN_CENTER); header.setBorder(Rectangle.NO_BORDER); header.setBorder(Rectangle.BOTTOM); document.setHeader(header); HeaderFooter footer = new HeaderFooter(new Phrase("globematics\nSecond line"), false); footer.setAlignment(HeaderFooter.ALIGN_CENTER); footer.setBorder(Rectangle.NO_BORDER); footer.setBorder(Rectangle.TOP); document.setFooter(footer);
/** * Constructs a <CODE>Header</CODE>-object with a pagenumber at the end. * * @param before the <CODE>Phrase</CODE> before the pagenumber * @param numbered <CODE>true</CODE> if the page has to be numbered */ public HeaderFooter(Phrase before, boolean numbered) { super(0, 0, 0, 0); setBorder(TOP + BOTTOM); setBorderWidth(1); this.numbered = numbered; this.before = before; }
Image logo = Image.getInstance("/image.gif"); logo.setAlignment(Image.MIDDLE); logo.scaleAbsoluteHeight(20); logo.scaleAbsoluteWidth(20); logo.scalePercent(100); Chunk chunk = new Chunk(logo, 0, -45); HeaderFooter header = new HeaderFooter(new Phrase(chunk), false); header.setAlignment(Element.ALIGN_CENTER); header.setBorder(Rectangle.NO_BORDER); document.setHeader(header);
/** * Constructs a <CODE>HeaderFooter</CODE>-object. * * @param before the <CODE>Phrase</CODE> before the pagenumber * @param after the <CODE>Phrase</CODE> before the pagenumber */ public HeaderFooter(Phrase before, Phrase after) { super(0, 0, 0, 0); setBorder(TOP + BOTTOM); setBorderWidth(1); numbered = true; this.before = before; this.after = after; }
public static void setFooterOnDocument( Document document, String footerText, Font font ) { boolean isNumbered = true; HeaderFooter footer = new HeaderFooter( new Phrase( footerText, font ), isNumbered ); footer.setBorder( Rectangle.NO_BORDER ); footer.setAlignment( Element.ALIGN_RIGHT ); document.setFooter( footer ); }
/** * Constructs a <CODE>HeaderFooter</CODE>-object. * * @param before the <CODE>Phrase</CODE> before the pagenumber * @param after the <CODE>Phrase</CODE> before the pagenumber */ public HeaderFooter(Phrase before, Phrase after) { super(0, 0, 0, 0); setBorder(TOP + BOTTOM); setBorderWidth(1); numbered = true; this.before = before; this.after = after; }
header.setBorder(Rectangle.NO_BORDER); header.setAlignment(Element.ALIGN_RIGHT); header.setPageNumber(0);
/** * Constructs a <CODE>HeaderFooter</CODE>-object. * * @param before the <CODE>Phrase</CODE> before the pagenumber * @param after the <CODE>Phrase</CODE> before the pagenumber */ public HeaderFooter(Phrase before, Phrase after) { super(0, 0, 0, 0); setBorder(TOP + BOTTOM); setBorderWidth(1); numbered = true; this.before = before; this.after = after; }
header.setBorder(Rectangle.NO_BORDER); header.setAlignment(Element.ALIGN_RIGHT); header.setPageNumber(0);
private void createWriter(Document document, String title) throws DocumentException, IOException { final PdfWriter writer = PdfWriter.getInstance(document, output); //writer.setViewerPreferences(PdfWriter.PageLayoutTwoColumnLeft); // title final HeaderFooter header = new HeaderFooter(new Phrase(title), false); header.setAlignment(Element.ALIGN_LEFT); header.setBorder(Rectangle.NO_BORDER); document.setHeader(header); // simple page numbers : x //HeaderFooter footer = new HeaderFooter(new Phrase(), true); //footer.setAlignment(Element.ALIGN_RIGHT); //footer.setBorder(Rectangle.TOP); //document.setFooter(footer); // add the event handler for advanced page numbers : x/y writer.setPageEvent(new PdfAdvancedPageNumberEvents()); }
/** * @see org.displaytag.export.BinaryExportView#doExport(OutputStream) */ public void doExport(OutputStream out) throws JspException { try { // Initialize the table with the appropriate number of columns initTable(); // Initialize the Document and register it with PdfWriter listener and the OutputStream Document document = new Document(PageSize.A4.rotate(), 60, 60, 40, 40); document.addCreationDate(); HeaderFooter footer = new HeaderFooter(new Phrase(TagConstants.EMPTY_STRING, smallFont), true); footer.setBorder(Rectangle.NO_BORDER); footer.setAlignment(Element.ALIGN_CENTER); PdfWriter.getInstance(document, out); // Fill the virtual PDF table with the necessary data generatePDFTable(); document.open(); document.setFooter(footer); document.add(this.tablePDF); document.close(); } catch (Exception e) { throw new PdfGenerationException(e); } }