Example usage for com.lowagie.text.pdf PdfName NONFULLSCREENPAGEMODE

List of usage examples for com.lowagie.text.pdf PdfName NONFULLSCREENPAGEMODE

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfName NONFULLSCREENPAGEMODE.

Prototype

PdfName NONFULLSCREENPAGEMODE

To view the source code for com.lowagie.text.pdf PdfName NONFULLSCREENPAGEMODE.

Click Source Link

Document

A name

Usage

From source file:net.mitnet.tools.pdf.book.pdf.util.PdfBookmarkBuilder.java

License:Open Source License

public void addBookmarks(String inputPdfFile, List<HashMap<String, Object>> bookmarks, String outputPdfFile)
        throws IOException, DocumentException {

    PdfReader reader = new PdfReader(inputPdfFile);

    PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(outputPdfFile));

    if (bookmarks != null) {
        System.out.println("bookmarks.size: " + bookmarks.size());
    }/*from w w  w .j a  v a2 s  .co  m*/
    System.out.println("bookmarks: " + bookmarks);

    stamper.setOutlines(bookmarks);

    stamper.addViewerPreference(PdfName.NONFULLSCREENPAGEMODE, PdfName.USEOUTLINES);

    stamper.close();
}

From source file:org.sejda.impl.itext.ViewerPreferencesTask.java

License:Apache License

/**
 * //w w  w  .  j a  v a2s .co  m
 * @param parameters
 * @return a map of preferences with corresponding value to be set on the documents
 */
private Map<PdfName, PdfObject> getConfiguredViewerPreferencesMap(ViewerPreferencesParameters parameters) {
    Map<PdfName, PdfObject> confPreferences = new HashMap<PdfName, PdfObject>();
    if (parameters.getDirection() != null) {
        confPreferences.put(PdfName.DIRECTION, ViewerPreferencesUtils.getDirection(parameters.getDirection()));
    }
    if (parameters.getDuplex() != null) {
        confPreferences.put(PdfName.DUPLEX, ViewerPreferencesUtils.getDuplex(parameters.getDuplex()));
    }
    if (parameters.getPrintScaling() != null) {
        confPreferences.put(PdfName.PRINTSCALING,
                ViewerPreferencesUtils.getPrintScaling(parameters.getPrintScaling()));
    }
    confPreferences.put(PdfName.NONFULLSCREENPAGEMODE,
            ViewerPreferencesUtils.getNFSMode(parameters.getNfsMode()));

    Set<PdfBooleanPreference> activePref = parameters.getEnabledPreferences();
    for (PdfBooleanPreference boolPref : PdfBooleanPreference.values()) {
        if (activePref.contains(boolPref)) {
            confPreferences.put(ViewerPreferencesUtils.getBooleanPreference(boolPref), PdfBoolean.PDFTRUE);
        } else {
            confPreferences.put(ViewerPreferencesUtils.getBooleanPreference(boolPref), PdfBoolean.PDFFALSE);
        }
    }
    return confPreferences;
}