use of com.lowagie.text.ExceptionConverter in project adempiere by adempiere.
the class SmjPdfReport method onOpenDocument.
//simpleLine
/**
* predefine los valores del pie de pagina ** predefined values footer
*
* @param writer
* @param document
*/
public void onOpenDocument(PdfWriter writer, Document document) {
total = writer.getDirectContent().createTemplate(100, 100);
total.setBoundingBox(new Rectangle(-20, -20, 100, 100));
try {
helv = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);
} catch (Exception e) {
throw new ExceptionConverter(e);
}
}
use of com.lowagie.text.ExceptionConverter in project drools by kiegroup.
the class EndPage method onEndPage.
public void onEndPage(PdfWriter writer, Document document) {
try {
// TODO this image never existed
Image image = Image.getInstance(DroolsDocsBuilder.class.getResource("guvnor-webapp.png"));
image.setAlignment(Image.RIGHT);
image.scaleAbsolute(100, 30);
Rectangle page = document.getPageSize();
PdfPTable head = new PdfPTable(2);
PdfPCell cell1 = new PdfPCell(image);
cell1.setHorizontalAlignment(Element.ALIGN_LEFT);
cell1.setBorder(0);
head.addCell(cell1);
PdfPCell cell2 = new PdfPCell(new Phrase(currentDate, DroolsDocsComponentFactory.HEADER_FOOTER_TEXT));
cell2.setHorizontalAlignment(Element.ALIGN_RIGHT);
cell2.setBorder(0);
head.addCell(cell2);
head.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin());
head.writeSelectedRows(0, -1, document.leftMargin(), page.getHeight() - document.topMargin() + head.getTotalHeight(), writer.getDirectContent());
} catch (Exception e) {
throw new ExceptionConverter(e);
}
}
Aggregations