Package com.lowagie.text.pdf

Examples of com.lowagie.text.pdf.PdfDestination


            if (uri != null) {
                if (uri.length() > 1 && uri.charAt(0) == '#') {
                    String anchor = uri.substring(1);
                    Box target = _sharedContext.getBoxById(anchor);
                    if (target != null) {
                        PdfDestination dest = createDestination(c, target);

                        if (dest != null) {
                            PdfAction action = new PdfAction();
                            if (!"".equals(handler.getAttributeValue(elem, "onclick"))) {
                                action = PdfAction.javaScript(handler.getAttributeValue(elem, "onclick"), _writer);
View Full Code Here


    public float getDeviceLength(float length) {
        return length / _dotsPerPoint;
    }

    private PdfDestination createDestination(RenderingContext c, Box box) {
        PdfDestination result = null;

        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;
    }
View Full Code Here

                    if (targetBox.getStyle().isIdent(CSSName.FS_NAMED_DESTINATION, IdentValue.CREATE)) {
                        String anchorName = (String) entry.getKey();
                        dests.add(new PdfString(anchorName, PdfString.TEXT_UNICODE));

                        PdfDestination dest = createDestination(c, targetBox);
                        if (dest != null) {
                            PdfIndirectReference ref = _writer.addToBody(dest).getIndirectReference();
                            dests.add(ref);
                        }
                    }
View Full Code Here

        }
    }

    private void writeBookmark(RenderingContext c, Box root, PdfOutline parent, Bookmark bookmark) {
        String href = bookmark.getHRef();
        PdfDestination target = null;
        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;
        }
View Full Code Here

TOP

Related Classes of com.lowagie.text.pdf.PdfDestination

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.