Package org.librebiz.pureport.definition

Examples of org.librebiz.pureport.definition.PageLayout


            }
        }
    }

    private void startPageLayout(Attributes attrs) {
        PageLayout layout = new PageLayout();
        layout.setPaperWidth(toQuantity(attrs.getValue("paper-width"), new Quantity(21, Unit.CM)));
        layout.setPaperHeight(toQuantity(attrs.getValue("paper-height"), new Quantity(29.7, Unit.CM)));
        layout.setTopMargin(toQuantity(attrs.getValue("top-margin")));
        layout.setBottomMargin(toQuantity(attrs.getValue("bottom-margin")));
        layout.setLeftMargin(toQuantity(attrs.getValue("left-margin")));
        layout.setRightMargin(toQuantity(attrs.getValue("right-margin")));
        String orientation = attrs.getValue("orientation");
        if ("portrait".equals(orientation)) {
            layout.setOrientation(PageLayout.PORTRAIT);
        } else if ("landscape".equals(orientation)) {
            layout.setOrientation(PageLayout.LANDSCAPE);
        } else if ("reverse-landscape".equals(orientation)) {
            layout.setOrientation(PageLayout.REVERSE_LANDSCAPE);
        }
        report.setPageLayout(layout);
    }
View Full Code Here


                    if (pageIndex >= pageStore.getPageCount()) {
                        return Printable.NO_SUCH_PAGE;
                    }
                    Page page = pageStore.getPage(pageIndex);
                    page.resolveForwards(formatter.getContext());
                    PageLayout layout = formatter.getPageLayout();
                    Rectangle2D rc = format == null
                            ? layout.getDrawableArea(Unit.PT)
                            : layout.getDrawableArea(format);
                    page.draw((Graphics2D)g, rc.getX(), rc.getY(),
                            rc.getHeight());
                    return Printable.PAGE_EXISTS;
                }
            }, formatter.getPageFormat());
View Full Code Here

            OutputStream out) throws IOException {
        try {
            PageStore pageStore = new PageStore();
            FontRenderContext frc = new FontRenderContext(null, true, true);
            Formatter fmt = new Formatter(report, context, frc, pageStore);
            PageLayout layout = report.getPageLayout();
            Rectangle2D bounds = layout.getBounds(Unit.PT);
            Rectangle2D drawable = layout.getDrawableArea(Unit.PT);
            Paper paper = new Paper();
            paper.setSize(bounds.getWidth(), bounds.getHeight());
            paper.setImageableArea(drawable.getX(), drawable.getY(),
                    drawable.getWidth(), drawable.getHeight());
            PageFormat pf = new PageFormat();
View Full Code Here

            });
        }
    }

    private void computeMargins() {
        PageLayout layout = report.getPageLayout();
        Rectangle2D rc = format == null
                ? layout.getDrawableArea(Unit.PT) : layout.getDrawableArea(format);
        top = rc.getY();
        width = rc.getWidth();
        height = rc.getHeight();
    }
View Full Code Here

TOP

Related Classes of org.librebiz.pureport.definition.PageLayout

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.