Examples of PageBox


Examples of org.xhtmlrenderer.render.PageBox

                (float) pdfCorner.getY() + getDeviceLength(bounds.height));
        return result;
    }
   
    public com.lowagie.text.Rectangle createTargetArea(RenderingContext c, Box box) {
        PageBox current = c.getPage();
        boolean inCurrentPage = box.getAbsY() > current.getTop() && box.getAbsY() < current.getBottom();
       
        if (inCurrentPage || box.isContainedInMarginBox()) {
            return createLocalTargetArea(c, box);
        } else {
            Rectangle bounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c);
            PageBox page = _root.getLayer().getPage(c, bounds.y);
           
            float bottom = getDeviceLength(page.getBottom() - (bounds.y + bounds.height) +
                                page.getMarginBorderPadding(c, CalculatedStyle.BOTTOM));
            float left = getDeviceLength(page.getMarginBorderPadding(c, CalculatedStyle.LEFT) + bounds.x);
           
            com.lowagie.text.Rectangle result =
                    new com.lowagie.text.Rectangle(
                            left,
                            bottom,
View Full Code Here

Examples of org.xhtmlrenderer.render.PageBox

    }
   
    private PdfDestination createDestination(RenderingContext c, Box box) {
        PdfDestination result;
       
        PageBox page = _root.getLayer().getPage(c, getPageRefY(box));
        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

Examples of org.xhtmlrenderer.render.PageBox

        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

Examples of org.xhtmlrenderer.render.PageBox

       
        return result;
    }
   
    private PagePosition calcPDFPagePosition(CssContext c, String id, Box box) {
        PageBox page = _root.getLayer().getLastPage(c, box);
        if (page == null) {
            return null;
        }
       
        float x = box.getAbsX() + page.getMarginBorderPadding(c, CalculatedStyle.LEFT);
        float y = (page.getBottom() - (box.getAbsY() + box.getHeight())) + page.getMarginBorderPadding(c, CalculatedStyle.BOTTOM);
        x /= _dotsPerPoint;
        y /= _dotsPerPoint;
       
        PagePosition result = new PagePosition();
        result.setId(id);
        result.setPageNo(page.getPageNo());
        result.setX(x);
        result.setY(y);
        result.setWidth(box.getEffectiveWidth() / _dotsPerPoint);
        result.setHeight(box.getHeight() / _dotsPerPoint);
       
View Full Code Here

Examples of org.xhtmlrenderer.render.PageBox

        if (running) {
            int headerHeight = layoutRunningHeader(c);
            int footerHeight = layoutRunningFooter(c);
            int spacingHeight = footerHeight == 0 ? 0 : getStyle().getBorderVSpacing(c);
           
            PageBox first = c.getRootLayer().getFirstPage(c, this);
            if (getAbsY() + getTy() + headerHeight + footerHeight + spacingHeight > first.getBottom()) {
                // XXX Performance problem here.  This forces the table
                // to move to the next page (which we want), but the initial
                // table layout run still completes (which we don't)                  
                setNeedPageClear(true);
            }
View Full Code Here

Examples of org.xhtmlrenderer.render.PageBox

        }
    }   

    private void calcPageClearance(LayoutContext c) {
        if (c.isPrint() && getStyle().isCollapseBorders()) {
            PageBox page = c.getRootLayer().getFirstPage(c, this);
            TableRowBox row = getFirstRow();
            if (row != null) {
                int spill = 0;
                for (Iterator i = row.getChildIterator(); i.hasNext(); ) {
                    TableCellBox cell = (TableCellBox)i.next();
                    BorderPropertySet collapsed = cell.getCollapsedPaintingBorder();
                    int tmp = (int)collapsed.top() / 2;
                    if (tmp > spill) {
                        spill = tmp;
                    }
                }
               
                int borderTop = getAbsY() + (int)getMargin(c).top() - spill;
                int delta = page.getTop() - borderTop;
                if (delta > 0) {
                    setY(getY() + delta);
                    setPageClearance(delta);
                    calcCanvasLocation();
                    c.translate(0, delta);
View Full Code Here

Examples of org.xhtmlrenderer.render.PageBox

            c.setExtraSpaceBottom(prevExtraBottom);
        }
    }
   
    private boolean isShouldMoveToNextPage(LayoutContext c) {
        PageBox page = c.getRootLayer().getFirstPage(c, this);
       
        if (getAbsY() + getHeight() < page.getBottom()) {
            return false;
        }
       
        for (Iterator i = getChildIterator(); i.hasNext(); ) {
            TableCellBox cell = (TableCellBox)i.next();
            int baseline = cell.calcBlockBaseline(c);
            if (baseline != BlockBox.NO_BASELINE && baseline < page.getBottom()) {
                return false;
            }
        }
       
        return true;
View Full Code Here

Examples of org.xhtmlrenderer.render.PageBox

            String uri = text.getParent().getElement().getAttribute("href");
            if (uri != null && uri.startsWith("#")) {
                String anchor = uri.substring(1);
                Box target = c.getBoxById(anchor);
                if (target != null) {
                    PageBox targetPage = c.getRootLayer().getPage(c, target.getAbsY());
                    return CounterFunction.createCounterText(IdentValue.DECIMAL, targetPage.getPageNo()+1);
                }
            }
            return "";
        }
View Full Code Here

Examples of org.xhtmlrenderer.render.PageBox

        Shape working = g.getClip();

        List pages = root.getPages();
        c.setPageCount(pages.size());
        for (int i = 0; i < pages.size(); i++) {
            PageBox page = (PageBox)pages.get(i);
            c.setPage(i, page);

            g.setClip(working);
           
            Rectangle overall = page.getScreenPaintingBounds(c, pagePaintingClearanceWidth);
            overall.x -= 1;
            overall.y -= 1;
            overall.width += 1;
            overall.height += 1;
           
            Rectangle bounds = new Rectangle(overall);
            bounds.width += 1;
            bounds.height += 1;
            if (working.intersects(bounds)) {
                page.paintBackground(c, pagePaintingClearanceWidth, Layer.PAGED_MODE_SCREEN);
                page.paintMarginAreas(c, pagePaintingClearanceWidth, Layer.PAGED_MODE_SCREEN);
                page.paintBorder(c, pagePaintingClearanceWidth, Layer.PAGED_MODE_SCREEN);
               
                Color old = g.getColor();
               
                g.setColor(Color.BLACK);
                g.drawRect(overall.x, overall.y, overall.width, overall.height);
                g.setColor(old);
               
                Rectangle content = page.getPagedViewClippingBounds(c, pagePaintingClearanceWidth);
                g.clip(content);
               
                int left = pagePaintingClearanceWidth +
                    page.getMarginBorderPadding(c, CalculatedStyle.LEFT);
                int top = page.getPaintingTop()
                    + page.getMarginBorderPadding(c, CalculatedStyle.TOP)
                    - page.getTop();
               
                g.translate(left, top);
                root.paint(c);
                g.translate(-left, -top);
               
View Full Code Here

Examples of org.xhtmlrenderer.render.PageBox

        } else if (pages.size() % 2 == 0) {
            pseudoPage = "left";
        } else {
            pseudoPage = "right";
        }
        PageBox pageBox = createPageBox(c, pseudoPage);
        if (pages.size() == 0) {
            pageBox.setTopAndBottom(c, 0);
        } else {
            PageBox previous = (PageBox)pages.get(pages.size()-1);
            pageBox.setTopAndBottom(c, previous.getBottom());
        }
       
        pageBox.setPageNo(pages.size());
        pages.add(pageBox);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.