Example usage for com.lowagie.text Document setMarginMirroringTopBottom

List of usage examples for com.lowagie.text Document setMarginMirroringTopBottom

Introduction

In this page you can find the example usage for com.lowagie.text Document setMarginMirroringTopBottom.

Prototype

public boolean setMarginMirroringTopBottom(boolean marginMirroringTopBottom) 

Source Link

Document

Set the margin mirroring.

Usage

From source file:org.opentestsystem.delivery.testreg.rest.view.PDFReportView.java

License:Open Source License

@Override
@SuppressWarnings("unchecked")
protected void buildPdfDocument(final Map<String, Object> model, final Document document,
        final PdfWriter writer, final HttpServletRequest request, final HttpServletResponse response)
        throws Exception {
    document.setMarginMirroringTopBottom(true);
    final List<TestAdminReport> dataList = (List<TestAdminReport>) model.get(DATA_LIST);
    final String reportType = ((String) model.get(REPORT_TYPE)).toUpperCase();
    final String levelOfReport = (String) model.get(LEVEL_OF_REPORT);
    final String headerMessage = (String) model.get(HEADER_MESSAGE);
    writer.setPageEvent(new PdfReportPageEventHelper(writer));
    HierarchyLevel level = null;/*from   w w  w. j  a v  a  2 s . c o  m*/
    if (levelOfReport != null) {
        level = HierarchyLevel.valueOf(levelOfReport);
    }
    final String headerColumns[] = this.reportHeaders.get(reportType);
    if (headerColumns != null) {
        PdfPTable table = createMessageHeaders(headerColumns, level, headerMessage);
        table.setSpacingAfter(10f);
        if (reportType.equals("PARTICIPATION_DETAIL_REPORT") || reportType.equals("PROCTOR_SCHEDULE_REPORT")
                || reportType.equals("STUDENT_SCHEDULE_REPORT")) {
            table = createHeaders(headerColumns, table);
        } else {
            table = createSummaryHeaders(headerColumns, level, table);
        }
        table.setHeaderRows(2);
        if (dataList.size() == 0) {
            addEmptyCell(table);
        } else {
            addData(table, dataList, level);
        }
        document.add(table);
    }
}