try {
FileOutputStream outputStream = new FileOutputStream(
pdfPath+"/driveTogether.pdf");
PdfWriter writer = PdfWriter.getInstance(doc, outputStream);
// PdfWriter writer = PdfWriter.getInstance(doc, new
// FileOutputStream(
// "/home/surfacing/data/Output.pdf"));
// Image image = Image.getInstance("banner5.png");
// doc.open();
// doc.add(image);
doc.open();
String pfad = FacesContext.getCurrentInstance()
.getExternalContext()
.getRealPath("/pdf/template.pdf");
logger.info("Loading PDF-Template: "+pfad);
PdfReader reader = new PdfReader(
pfad );
PdfImportedPage page = writer.getImportedPage(reader, 1);
PdfContentByte cb = writer.getDirectContent();
cb.addTemplate(page, 0, 0);
doHeader();
doParagraph(trip, forUser);