Example usage for com.lowagie.text PageSize getRectangle

List of usage examples for com.lowagie.text PageSize getRectangle

Introduction

In this page you can find the example usage for com.lowagie.text PageSize getRectangle.

Prototype

public static Rectangle getRectangle(String name) 

Source Link

Document

This method returns a Rectangle based on a String.

Usage

From source file:ro.nextreports.engine.exporter.RtfExporter.java

License:Apache License

protected void initExport() throws QueryException {
    if (!bean.isSubreport()) {
        Padding margins = bean.getReportLayout().getPagePadding();

        Rectangle rectangle;/*from  ww w.ja  v  a 2  s . c o  m*/
        if (ReportLayout.CUSTOM.equals(bean.getReportLayout().getPageFormat())) {
            PaperSize customSize = bean.getReportLayout().getPaperSize();
            rectangle = new Rectangle(customSize.getWidthPoints(), customSize.getHeightPoints());
        } else {
            rectangle = PageSize.getRectangle(getPageFormat());
        }

        document = new Document(rectangle, getPoints(margins.getLeft()), getPoints(margins.getRight()),
                getPoints(margins.getTop()), getPoints(margins.getBottom()));
        if (bean.getReportLayout().getOrientation() == LANDSCAPE) {
            document.setPageSize(rectangle.rotate());
        }
        RtfWriter2 writer2 = RtfWriter2.getInstance(document, getOut());
    }
    try {
        if (!bean.isSubreport()) {
            buildHeader();
            buildFooter();
            addMetaData();
            document.open();
        }
        table = buildRtfTable(PRINT_DOCUMENT);
    } catch (DocumentException e) {
        e.printStackTrace();
        throw new QueryException(e);
    }
}