@ Override public void onOpenDocument ( final PdfWriter writer , final Document document ) { try { bf = BaseFont . createFont ( BaseFont . HELVETICA , BaseFont . CP1252 , BaseFont . NOT_EMBEDDED ) ; cb = writer . getDirectContent ( ) ; template = cb . createTemplate ( 50 , 50 ) ; } catch ( final DocumentException de ) { throw new IllegalStateException ( de ) ; } catch ( final IOException ioe ) { throw new IllegalStateException ( ioe ) ; } }
we override the onOpenDocument method .