Example usage for com.lowagie.text.pdf PdfDestination XYZ

List of usage examples for com.lowagie.text.pdf PdfDestination XYZ

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfDestination XYZ.

Prototype

int XYZ

To view the source code for com.lowagie.text.pdf PdfDestination XYZ.

Click Source Link

Document

This is a possible destination type

Usage

From source file:com.logiware.accounting.reports.ArDisputeReportCreator.java

private void init(String fileName) throws Exception {
    document = new Document(PageSize.A4);
    document.setMargins(5, 5, 5, 30);/*w  w w .  j  a  v a  2  s .  co  m*/
    writer = PdfWriter.getInstance(document, new FileOutputStream(fileName));
    writer.setPdfVersion(PdfWriter.PDF_VERSION_1_7);
    writer.setUserunit(1f);
    writer.setPageEvent(new ArDisputeReportCreator(arReportsForm, contextPath));
    document.open();
    writer.setOpenAction(
            PdfAction.gotoLocalPage(1, new PdfDestination(PdfDestination.XYZ, -1, -1, 1f), writer));
}

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;/*from   ww  w.  j ava  2s  .c  om*/

    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 .j a  v  a  2 s . co  m*/

        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);
    }
}

From source file:org.eclipse.birt.report.engine.emitter.pdf.PDFPage.java

License:Open Source License

private void createBookmark(String bookmark, float x, float y, float width, float height) {
    contentByte.localDestination(bookmark, new PdfDestination(PdfDestination.XYZ, -1, transformY(y), 0));
}

From source file:org.xhtmlrenderer.pdf.ITextOutputDevice.java

License:Open Source License

private PdfDestination createDestination(RenderingContext c, Box box) {
    PdfDestination result = null;/*from  w  ww.jav  a 2s  . c o  m*/

    PageBox page = _root.getLayer().getPage(c, getPageRefY(box));
    if (page != null) {
        int distanceFromTop = page.getMarginBorderPadding(c, CalculatedStyle.TOP);
        distanceFromTop += box.getAbsY() + box.getMargin(c).top() - page.getTop();
        result = new PdfDestination(PdfDestination.XYZ, 0,
                page.getHeight(c) / _dotsPerPoint - distanceFromTop / _dotsPerPoint, 0);
        result.addPage(_writer.getPageReference(_startPageNo + page.getPageNo() + 1));
    }

    return result;
}

From source file:org.xhtmlrenderer.pdf.ITextOutputDevice.java

License:Open Source License

private void writeBookmark(RenderingContext c, Box root, PdfOutline parent, Bookmark bookmark) {
    String href = bookmark.getHRef();
    PdfDestination target = null;/*w  w  w .j  a  v  a  2 s .  c  om*/
    if (href.length() > 0 && href.charAt(0) == '#') {
        Box box = _sharedContext.getBoxById(href.substring(1));
        if (box != null) {
            PageBox page = root.getLayer().getPage(c, getPageRefY(box));
            int distanceFromTop = page.getMarginBorderPadding(c, CalculatedStyle.TOP);
            distanceFromTop += box.getAbsY() - page.getTop();
            target = new PdfDestination(PdfDestination.XYZ, 0, normalizeY(distanceFromTop / _dotsPerPoint), 0);
            target.addPage(_writer.getPageReference(_startPageNo + page.getPageNo() + 1));
        }
    }
    if (target == null) {
        target = _defaultDestination;
    }
    PdfOutline outline = new PdfOutline(parent, target, bookmark.getName());
    writeBookmarks(c, root, outline, bookmark.getChildren());
}