Examples of PageBox


Examples of org.xhtmlrenderer.render.PageBox

    }
   
    public void layoutPages(LayoutContext c) {
        c.setRootDocumentLayer(c.getRootLayer());
        for (Iterator i = _pages.iterator(); i.hasNext(); ) {
            PageBox pageBox = (PageBox)i.next();
            pageBox.layout(c);
        }
    }
View Full Code Here

Examples of org.xhtmlrenderer.render.PageBox

        root.getLayer().layoutPages(c);
        _root = root;
    }
   
    private Rectangle getInitialExtents(LayoutContext c) {
        PageBox first = Layer.createPageBox(c, "first");
       
        return new Rectangle(0, 0, first.getContentWidth(c), first.getContentHeight(c));
    }
View Full Code Here

Examples of org.xhtmlrenderer.render.PageBox

    public void writeNextDocument(int initialPageNo) throws DocumentException {
        List pages = _root.getLayer().getPages();
       
        RenderingContext c = newRenderingContext();
        c.setInitialPageNo(initialPageNo);
        PageBox firstPage = (PageBox)pages.get(0);
        com.lowagie.text.Rectangle firstPageSize = new com.lowagie.text.Rectangle(
                0, 0,
                firstPage.getWidth(c) / _dotsPerPoint,
                firstPage.getHeight(c) / _dotsPerPoint);
       
        _outputDevice.setStartPageNo(_writer.getPageNumber());
       
        _pdfDoc.setPageSize(firstPageSize);
        _pdfDoc.newPage()
View Full Code Here

Examples of org.xhtmlrenderer.render.PageBox

    public void createPDF(OutputStream os, boolean finish, int initialPageNo) throws DocumentException {
        List pages = _root.getLayer().getPages();
       
        RenderingContext c = newRenderingContext();
        c.setInitialPageNo(initialPageNo);
        PageBox firstPage = (PageBox)pages.get(0);
        com.lowagie.text.Rectangle firstPageSize = new com.lowagie.text.Rectangle(
                0, 0,
                firstPage.getWidth(c) / _dotsPerPoint,
                firstPage.getHeight(c) / _dotsPerPoint);
       
        com.lowagie.text.Document doc =
            new com.lowagie.text.Document(firstPageSize, 0, 0, 0, 0);
        PdfWriter writer = PdfWriter.getInstance(doc, os);
        if (_pdfVersion != null) {
View Full Code Here

Examples of org.xhtmlrenderer.render.PageBox

        _root.getLayer().assignPagePaintingPositions(c, Layer.PAGED_MODE_PRINT);
       
        int pageCount = _root.getLayer().getPages().size();
        c.setPageCount(pageCount);
        for (int i = 0; i < pageCount; i++) {
            PageBox currentPage = (PageBox)pages.get(i);
            c.setPage(i, currentPage);
            paintPage(c, writer, currentPage);
            _outputDevice.finishPage();
            if (i != pageCount - 1) {
                PageBox nextPage = (PageBox)pages.get(i+1);
                com.lowagie.text.Rectangle nextPageSize = new com.lowagie.text.Rectangle(
                        0, 0,
                        nextPage.getWidth(c) / _dotsPerPoint,
                        nextPage.getHeight(c) / _dotsPerPoint);
                doc.setPageSize(nextPageSize);
                doc.newPage();
                _outputDevice.initializePage(
                        writer.getDirectContent(), nextPageSize.getHeight());
            }
View Full Code Here

Examples of org.xhtmlrenderer.render.PageBox

    public boolean isPageBreaksChange(LayoutContext c, int posDeltaY) {
        if (! c.isPageBreaksAllowed()) {
            return false;
        }
       
        PageBox page = c.getRootLayer().getFirstPage(c, this);
       
        int bottomEdge = getAbsY() + getChildrenHeight();
       
        return bottomEdge >= page.getBottom() - c.getExtraSpaceBottom() ||
                    bottomEdge + posDeltaY >= page.getBottom() - c.getExtraSpaceBottom();
    }
View Full Code Here

Examples of org.xhtmlrenderer.render.PageBox

            RelayoutDataList relayoutDataList, int start, int end, boolean onNewPage) {
        int childOffset = relayoutDataList.get(start).getChildOffset();

        if (onNewPage) {
            Box startBox = (Box) localChildren.get(start);
            PageBox startPageBox = c.getRootLayer().getFirstPage(c, startBox);
            childOffset += startPageBox.getBottom() - startBox.getAbsY();
        }

        // reset height of parent as it is used for Y-setting of children
        block.setHeight(childOffset);
View Full Code Here

Examples of org.xhtmlrenderer.render.PageBox

    public boolean isPageBreaksChange(LayoutContext c, int posDeltaY) {
        if (! c.isPageBreaksAllowed()) {
            return false;
        }
       
        PageBox page = c.getRootLayer().getFirstPage(c, this);
       
        int bottomEdge = getAbsY() + getChildrenHeight();
       
        return page != null && (bottomEdge >= page.getBottom() - c.getExtraSpaceBottom() ||
                    bottomEdge + posDeltaY >= page.getBottom() - c.getExtraSpaceBottom());
    }
View Full Code Here

Examples of org.xhtmlrenderer.render.PageBox

                extents = new Rectangle(0, 0, 1, 1);
            }

            return extents;
        } else {
            PageBox first = Layer.createPageBox(c, "first");
            return new Rectangle(0, 0,
                    first.getContentWidth(c), first.getContentHeight(c));
        }
    }
View Full Code Here

Examples of org.xhtmlrenderer.render.PageBox

        } else if (pages.size() % 2 == 0) {
            pseudoPage = "right";
        } else {
            pseudoPage = "left";
        }
        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.