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

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

Introduction

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

Prototype

int NonFullScreenPageModeUseThumbs

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

Click Source Link

Document

A viewer preference

Usage

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

License:Open Source License

/**
 * // w  ww . j a v a  2s  .com
 * @param nfsmode
 * @return the non full screen mode to iText
 */
private int getNFSMode(String nfsmode) {
    int retVal = PdfWriter.NonFullScreenPageModeUseNone;
    if (SetViewerParsedCommand.NFSM_OCONTENT.equals(nfsmode)) {
        retVal = PdfWriter.NonFullScreenPageModeUseOC;
    } else if (SetViewerParsedCommand.NFSM_OUTLINES.equals(nfsmode)) {
        retVal = PdfWriter.NonFullScreenPageModeUseOutlines;
    } else if (SetViewerParsedCommand.NFSM_THUMBS.equals(nfsmode)) {
        retVal = PdfWriter.NonFullScreenPageModeUseThumbs;
    }
    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  . jav 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;
}

From source file:org.squale.welcom.outils.pdf.WPdfUtil.java

License:Open Source License

/**
 * Ajoute dans les parametres du report les paramtres pour l'ouverture en plein ecran Utilise itext.jar
 * /*from  w w  w .  j av a 2  s  . co m*/
 * @param report : report
 * @param out : flux pour ecrire
 * @throws DocumentException : Probleme a la lecture du document
 * @throws IOException : Probleme a l'ecriture dans la stream
 */
public static void fullScreen(final byte report[], final OutputStream out)
        throws DocumentException, IOException {
    final PdfStamper stamper = new PdfStamper(new PdfReader(report), out);

    stamper.setViewerPreferences(PdfWriter.PageLayoutTwoColumnRight | PdfWriter.PageModeFullScreen
            | PdfWriter.NonFullScreenPageModeUseThumbs);

    stamper.close();
}