Package org.xhtmlrenderer.render

Examples of org.xhtmlrenderer.render.Box


                    runEnd = offset - 1;
                }
            }
            if (mightNeedRelayout) {
                int runStart = relayoutDataList.getRunStart(runEnd);
                Box runEndChild = block.getChild(runEnd);
                if (c.getRootLayer().crossesPageBreak(c,
                        block.getChild(runStart).getAbsY(),
                        runEndChild.getAbsY() + runEndChild.getHeight())) {
                    result.setChanged(true);
                    block.resetChildren(c, runStart, offset);
                    result.setChildOffset(relayoutRun(c, localChildren, block,
                            relayoutDataList, runStart, offset, true));
                    runEndChild = block.getChild(runEnd);
                    if (c.getRootLayer().crossesPageBreak(c,
                            block.getChild(runStart).getAbsY(),
                            runEndChild.getAbsY() + runEndChild.getHeight())) {
                        block.resetChildren(c, runStart, offset);
                        result.setChildOffset(relayoutRun(c, localChildren, block,
                                relayoutDataList, runStart, offset, false));
                    }
                }
View Full Code Here


            NamespaceHandler handler = _sharedContext.getNamespaceHandler();
            String uri = handler.getLinkUri(elem);
            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);
                       
                        PdfAction action = new PdfAction();
                        if (!"".equals(handler.getAttributeValue(elem, "onclick"))) {
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));
            }
        }
View Full Code Here

        for (Iterator i = idMap.entrySet().iterator(); i.hasNext(); )
        {
            Map.Entry entry = (Entry)i.next();
            String id = (String)entry.getKey();
            if (pattern.matcher(id).find()) {
                Box box = (Box)entry.getValue();
                PagePosition pos = calcPDFPagePosition(c, id, box);
                if (pos != null) {
                    result.add(pos);   
                }
            }
View Full Code Here

            LayoutContext c, List localChildren, BlockBox block,
            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();
        }

        for (int i = start; i <= end; i++) {
            BlockBox child = (BlockBox) localChildren.get(i);
View Full Code Here

        }
        return result;
    }
   
    private boolean isNeedAnalyzePageBreaks() {
        Box b = getParent();
        while (b != null) {
            if (b.getStyle().isTable() && b.getStyle().isPaginateTable()) {
                return false;
            }
           
            b = b.getParent();
        }
       
        return true;
    }
View Full Code Here

            container.updateTop(c, getAbsY());
            container.updateBottom(c, getAbsY() + getHeight());
        }
       
        for (Iterator i = getChildIterator(); i.hasNext(); ) {
            Box b = (Box)i.next();
            b.analyzePageBreaks(c, _contentLimitContainer);
        }
       
        if (container != null && _contentLimitContainer.isContainsMultiplePages() &&
                (getExtraSpaceTop() > 0 || getExtraSpaceBottom() > 0)) {
            propagateExtraSpace(c, container, _contentLimitContainer, getExtraSpaceTop(), getExtraSpaceBottom());
View Full Code Here

                container.updateTop(c, getAbsY());
                container.updateBottom(c, getAbsY() + getHeight());
            }
           
            for (Iterator i = getChildIterator(); i.hasNext(); ) {
                Box b = (Box)i.next();
                b.analyzePageBreaks(c, _contentLimitContainer);
            }
           
            if (container != null && _contentLimitContainer.isContainsMultiplePages()) {
                propagateExtraSpace(c, container, _contentLimitContainer, getExtraSpaceTop(), getExtraSpaceBottom());
            }
View Full Code Here

        }
    }

    private void saveBoxModel(File page, File outputDir, int width) throws IOException {
        BoxRenderer renderer = new BoxRenderer(page, width);
        Box box;
        try {
            box = renderer.render();
        } catch (Exception e) {
            System.err.println("Could not render input file, skipping: " + page + " err: " + e.getMessage());
            failedCount++;
            return;
        }
        LayoutContext layoutContext = renderer.getLayoutContext();
        String inputFileName = page.getName();
        writeToFile(outputDir, inputFileName + RENDER_SFX, box.dump(layoutContext, "", Box.DUMP_RENDER));
        writeToFile(outputDir, inputFileName + LAYOUT_SFX, box.dump(layoutContext, "", Box.DUMP_LAYOUT));
        fileCount++;
    }
View Full Code Here

        public String calculate(RenderingContext c, FSFunction function, InlineText text) {
            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

TOP

Related Classes of org.xhtmlrenderer.render.Box

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.