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

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

Introduction

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

Prototype

int HideWindowUI

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

Click Source Link

Document

A viewer preference

Usage

From source file:org.pdfsam.console.business.pdf.handlers.SetViewerCmdExecutor.java

License:Open Source License

/**
 * @param parsedCommand//from w w  w .  j av a  2s . com
 * @return the viewer options
 */
private int getVewerOptions(SetViewerParsedCommand parsedCommand) {
    int retVal = 0;
    if (parsedCommand.isCenterWindow()) {
        retVal |= PdfWriter.CenterWindow;
    }
    if (parsedCommand.isDisplayDocTitle()) {
        retVal |= PdfWriter.DisplayDocTitle;
    }
    if (parsedCommand.isFitWindow()) {
        retVal |= PdfWriter.FitWindow;
    }
    if (parsedCommand.isHideMenu()) {
        retVal |= PdfWriter.HideMenubar;
    }
    if (parsedCommand.isHideToolBar()) {
        retVal |= PdfWriter.HideToolbar;
    }
    if (parsedCommand.isHideWindowUI()) {
        retVal |= PdfWriter.HideWindowUI;
    }
    if (parsedCommand.isNoPrintScaling()) {
        retVal |= PdfWriter.PrintScalingNone;
    }
    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.//from   w w  w  .  j av a 2 s .  c o  m
 */
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;
}