List of usage examples for com.lowagie.text.pdf PdfWriter setOpenAction
public void setOpenAction(PdfAction action)
From source file:com.qcadoo.report.api.pdf.ReportPdfView.java
License:Open Source License
@Override protected final void buildPdfDocument(final Map<String, Object> model, final Document document, final PdfWriter writer, final HttpServletRequest request, final HttpServletResponse response) { String fileName;// w ww . ja v a 2 s .co m try { PdfAction ac = PdfAction.gotoLocalPage(1, new PdfDestination(PdfDestination.XYZ, -1, -1, 1f), writer); writer.setOpenAction(ac); fileName = addContent(document, model, LocaleContextHolder.getLocale(), writer); } catch (DocumentException e) { throw new IllegalStateException(e.getMessage(), e); } catch (IOException e) { throw new IllegalStateException(e.getMessage(), e); } response.setHeader("Content-disposition", "inline; filename=" + fileName + "." + ReportService.ReportType.PDF.getExtension()); }
From source file:gov.utah.health.uper.reports.Registration.java
@Override protected void buildPdfDocument(Map<String, Object> model, Document document, PdfWriter writer, HttpServletRequest request, HttpServletResponse response) throws DocumentException { try {//from www .ja v a 2 s . c om Map<String, Object> dataCollections = (Map<String, Object>) model.get("formData"); ApplicationBean app = (ApplicationBean) dataCollections.get("application"); PatientBean pt = (PatientBean) dataCollections.get("patient"); setUpPage(document); buildHeader(document, app); buildPatient(document, pt); buildParent(document, pt); buildPhysician(document, pt); buildFooter(document); writer.setOpenAction( PdfAction.gotoLocalPage(1, new PdfDestination(PdfDestination.XYZ, 0, 10000, 1), writer)); } catch (Exception e) { LOG.error("Exception was caught while preparing UPER Registration.", e); } }