Example usage for com.lowagie.text.pdf PdfWriter DirectionL2R

List of usage examples for com.lowagie.text.pdf PdfWriter DirectionL2R

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfWriter DirectionL2R.

Prototype

int DirectionL2R

To view the source code for com.lowagie.text.pdf PdfWriter DirectionL2R.

Click Source Link

Document

A viewer preference

Usage

From source file:org.pdfsam.console.business.parser.validators.SetViewerCmdValidator.java

License:Open Source License

/**
 * @param direction //from w  ww .j  a  v  a2 s.c o m
 * @return The direction to iText 
 */
private int getDirection(String direction) {
    int retVal = 0;
    if (SetViewerParsedCommand.D_R2L.equals(direction)) {
        retVal = PdfWriter.DirectionR2L;
    } else if (SetViewerParsedCommand.D_L2R.equals(direction)) {
        retVal = PdfWriter.DirectionL2R;
    }
    return retVal;
}

From source file:org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.internal.PdfDocumentWriter.java

License:Open Source License

/**
 * Extracts the Page Layout and page mode settings for this PDF (ViewerPreferences). All preferences are defined as
 * properties which have to be set before the target is opened.
 *
 * @return the ViewerPreferences./*w w  w.jav  a 2s  .c  om*/
 */
private int getViewerPreferences() {
    final String pageLayout = config.getConfigProperty(
            "org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PageLayout");
    final String pageMode = config.getConfigProperty(
            "org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PageMode");
    final String fullScreenMode = config.getConfigProperty(
            "org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.FullScreenMode");
    final boolean hideToolBar = "true".equals(config.getConfigProperty(
            "org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.HideToolBar"));
    final boolean hideMenuBar = "true".equals(config.getConfigProperty(
            "org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.HideMenuBar"));
    final boolean hideWindowUI = "true".equals(config.getConfigProperty(
            "org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.HideWindowUI"));
    final boolean fitWindow = "true".equals(config.getConfigProperty(
            "org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.FitWindow"));
    final boolean centerWindow = "true".equals(config.getConfigProperty(
            "org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.CenterWindow"));
    final boolean displayDocTitle = "true".equals(config.getConfigProperty(
            "org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.DisplayDocTitle"));
    final boolean printScalingNone = "true".equals(config.getConfigProperty(
            "org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PrintScalingNone"));
    final String direction = config.getConfigProperty(
            "org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.Direction");

    int viewerPreferences = 0;
    if ("PageLayoutOneColumn".equals(pageLayout)) {
        viewerPreferences = PdfWriter.PageLayoutOneColumn;
    } else if ("PageLayoutSinglePage".equals(pageLayout)) {
        viewerPreferences = PdfWriter.PageLayoutSinglePage;
    } else if ("PageLayoutTwoColumnLeft".equals(pageLayout)) {
        viewerPreferences = PdfWriter.PageLayoutTwoColumnLeft;
    } else if ("PageLayoutTwoColumnRight".equals(pageLayout)) {
        viewerPreferences = PdfWriter.PageLayoutTwoColumnRight;
    } else if ("PageLayoutTwoPageLeft".equals(pageLayout)) {
        viewerPreferences = PdfWriter.PageLayoutTwoPageLeft;
    } else if ("PageLayoutTwoPageRight".equals(pageLayout)) {
        viewerPreferences = PdfWriter.PageLayoutTwoPageRight;
    }

    if ("PageModeUseNone".equals(pageMode)) {
        viewerPreferences |= PdfWriter.PageModeUseNone;
    } else if ("PageModeUseOutlines".equals(pageMode)) {
        viewerPreferences |= PdfWriter.PageModeUseOutlines;
    } else if ("PageModeUseThumbs".equals(pageMode)) {
        viewerPreferences |= PdfWriter.PageModeUseThumbs;
    } else if ("PageModeFullScreen".equals(pageMode)) {
        viewerPreferences |= PdfWriter.PageModeFullScreen;
        if ("NonFullScreenPageModeUseNone".equals(fullScreenMode)) {
            viewerPreferences = PdfWriter.NonFullScreenPageModeUseNone;
        } else if ("NonFullScreenPageModeUseOC".equals(fullScreenMode)) {
            viewerPreferences |= PdfWriter.NonFullScreenPageModeUseOC;
        } else if ("NonFullScreenPageModeUseOutlines".equals(fullScreenMode)) {
            viewerPreferences |= PdfWriter.NonFullScreenPageModeUseOutlines;
        } else if ("NonFullScreenPageModeUseThumbs".equals(fullScreenMode)) {
            viewerPreferences |= PdfWriter.NonFullScreenPageModeUseThumbs;
        }
    } else if ("PageModeUseOC".equals(pageMode)) {
        viewerPreferences |= PdfWriter.PageModeUseOC;
    } else if ("PageModeUseAttachments".equals(pageMode)) {
        viewerPreferences |= PdfWriter.PageModeUseAttachments;
    }

    if (hideToolBar) {
        viewerPreferences |= PdfWriter.HideToolbar;
    }

    if (hideMenuBar) {
        viewerPreferences |= PdfWriter.HideMenubar;
    }

    if (hideWindowUI) {
        viewerPreferences |= PdfWriter.HideWindowUI;
    }

    if (fitWindow) {
        viewerPreferences |= PdfWriter.FitWindow;
    }
    if (centerWindow) {
        viewerPreferences |= PdfWriter.CenterWindow;
    }
    if (displayDocTitle) {
        viewerPreferences |= PdfWriter.DisplayDocTitle;
    }
    if (printScalingNone) {
        viewerPreferences |= PdfWriter.PrintScalingNone;
    }

    if ("DirectionL2R".equals(direction)) {
        viewerPreferences |= PdfWriter.DirectionL2R;
    } else if ("DirectionR2L".equals(direction)) {
        viewerPreferences |= PdfWriter.DirectionR2L;
    }

    if (logger.isDebugEnabled()) {
        logger.debug("viewerPreferences = 0b" + Integer.toBinaryString(viewerPreferences));
    }
    return viewerPreferences;
}