001/* 002 * $Id: PdfViewerPreferences.java 4784 2011-03-15 08:33:00Z blowagie $ 003 * 004 * This file is part of the iText (R) project. 005 * Copyright (c) 1998-2011 1T3XT BVBA 006 * Authors: Bruno Lowagie, Paulo Soares, et al. 007 * 008 * This program is free software; you can redistribute it and/or modify 009 * it under the terms of the GNU Affero General Public License version 3 010 * as published by the Free Software Foundation with the addition of the 011 * following permission added to Section 15 as permitted in Section 7(a): 012 * FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY 1T3XT, 013 * 1T3XT DISCLAIMS THE WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. 014 * 015 * This program is distributed in the hope that it will be useful, but 016 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 017 * or FITNESS FOR A PARTICULAR PURPOSE. 018 * See the GNU Affero General Public License for more details. 019 * You should have received a copy of the GNU Affero General Public License 020 * along with this program; if not, see http://www.gnu.org/licenses or write to 021 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 022 * Boston, MA, 02110-1301 USA, or download the license from the following URL: 023 * http://itextpdf.com/terms-of-use/ 024 * 025 * The interactive user interfaces in modified source and object code versions 026 * of this program must display Appropriate Legal Notices, as required under 027 * Section 5 of the GNU Affero General Public License. 028 * 029 * In accordance with Section 7(b) of the GNU Affero General Public License, 030 * a covered work must retain the producer line in every PDF that is created 031 * or manipulated using iText. 032 * 033 * You can be released from the requirements of the license by purchasing 034 * a commercial license. Buying such a license is mandatory as soon as you 035 * develop commercial activities involving the iText software without 036 * disclosing the source code of your own applications. 037 * These activities include: offering paid services to customers as an ASP, 038 * serving PDFs on the fly in a web application, shipping iText with a closed 039 * source product. 040 * 041 * For more information, please contact iText Software Corp. at this 042 * address: sales@itextpdf.com 043 */ 044package com.itextpdf.text.pdf.interfaces; 045 046import com.itextpdf.text.pdf.PdfName; 047import com.itextpdf.text.pdf.PdfObject; 048 049/** 050 * Viewer preferences are described in section 3.6.1 and 8.1 of the 051 * PDF Reference 1.7 (Table 3.25 on p139-142 and Table 8.1 on p579-581). 052 * They are explained in section 13.1 of the book 'iText in Action'. 053 * The values of the different preferences were originally stored 054 * in class PdfWriter, but they have been moved to this separate interface 055 * for reasons of convenience. 056 */ 057 058public interface PdfViewerPreferences { 059 060 /** 061 * Sets the page layout and page mode preferences by ORing one or two of these constants. 062 * <p> 063 * <ul> 064 * <li>The page layout to be used when the document is opened (choose one). 065 * <ul> 066 * <li><b>PageLayoutSinglePage</b> - Display one page at a time. (default) 067 * <li><b>PageLayoutOneColumn</b> - Display the pages in one column. 068 * <li><b>PageLayoutTwoColumnLeft</b> - Display the pages in two columns, with 069 * odd-numbered pages on the left. 070 * <li><b>PageLayoutTwoColumnRight</b> - Display the pages in two columns, with 071 * odd-numbered pages on the right. 072 * <li><b>PageLayoutTwoPageLeft</b> - Display the pages two at a time, with 073 * odd-numbered pages on the left. 074 * <li><b>PageLayoutTwoPageRight</b> - Display the pages two at a time, with 075 * odd-numbered pages on the right. 076 * </ul> 077 * <li>The page mode how the document should be displayed 078 * when opened (choose one). 079 * <ul> 080 * <li><b>PageModeUseNone</b> - Neither document outline nor thumbnail images visible. (default) 081 * <li><b>PageModeUseOutlines</b> - Document outline visible. 082 * <li><b>PageModeUseThumbs</b> - Thumbnail images visible. 083 * <li><b>PageModeFullScreen</b> - Full-screen mode, with no menu bar, window 084 * controls, or any other window visible. 085 * <li><b>PageModeUseOC</b> - Optional content group panel visible 086 * <li><b>PageModeUseAttachments</b> - Attachments panel visible 087 * </ul> 088 * </ul> 089 * For backward compatibility these values are also supported, 090 * but it's better to use method <code>addViewerPreference(key, value)</code> 091 * if you want to change the following preferences: 092 * <ul> 093 * <li><b>HideToolbar</b> - A flag specifying whether to hide the viewer application's tool 094 * bars when the document is active. 095 * <li><b>HideMenubar</b> - A flag specifying whether to hide the viewer application's 096 * menu bar when the document is active. 097 * <li><b>HideWindowUI</b> - A flag specifying whether to hide user interface elements in 098 * the document's window (such as scroll bars and navigation controls), 099 * leaving only the document's contents displayed. 100 * <li><b>FitWindow</b> - A flag specifying whether to resize the document's window to 101 * fit the size of the first displayed page. 102 * <li><b>CenterWindow</b> - A flag specifying whether to position the document's window 103 * in the center of the screen. 104 * <li><b>DisplayDocTitle</b> - A flag specifying whether to display the document's title 105 * in the top bar. 106 * <li>The predominant reading order for text. This entry has no direct effect on the 107 * document's contents or page numbering, but can be used to determine the relative 108 * positioning of pages when displayed side by side or printed <i>n-up</i> (choose one). 109 * <ul> 110 * <li><b>DirectionL2R</b> - Left to right 111 * <li><b>DirectionR2L</b> - Right to left (including vertical writing systems such as 112 * Chinese, Japanese, and Korean) 113 * </ul> 114 * <li>The document's page mode, specifying how to display the 115 * document on exiting full-screen mode. It is meaningful only 116 * if the page mode is <b>PageModeFullScreen</b> (choose one). 117 * <ul> 118 * <li><b>NonFullScreenPageModeUseNone</b> - Neither document outline nor thumbnail images 119 * visible 120 * <li><b>NonFullScreenPageModeUseOutlines</b> - Document outline visible 121 * <li><b>NNonFullScreenPageModeUseThumbs</b> - Thumbnail images visible 122 * <li><b>NonFullScreenPageModeUseOC</b> - Optional content group panel visible 123 * </ul> 124 * <li><b>PrintScalingNone</b> - Indicates that the print dialog should reflect no page scaling. 125 * </ul> 126 * @param preferences the viewer preferences 127 * @see PdfViewerPreferences#addViewerPreference 128 */ 129 public void setViewerPreferences(int preferences); 130 131 /** 132 * Adds a viewer preference. 133 * <ul> 134 * <li>In case the key is one of these values: 135 * <ul> 136 * <li>PdfName.<b>HIDETOOLBAR</b> 137 * <li>PdfName.<b>HIDEMENUBAR</b> 138 * <li>PdfName.<b>HIDEWINDOWUI</b> 139 * <li>PdfName.<b>FITWINDOW</b> 140 * <li>PdfName.<b>CENTERWINDOW</b> 141 * <li>PdfName.<b>DISPLAYDOCTITLE</b> 142 * </ul> 143 * The value must be a of type PdfBoolean (true or false). 144 * <li>In case the key is PdfName.<b>NONFULLSCREENPAGEMODE</b>, 145 * the value must be one of these names: 146 * <ul> 147 * <li>PdfName.<b>USENONE</b> 148 * <li>PdfName.<b>USEOUTLINES</b> 149 * <li>PdfName.<b>USETHUMBS</b> 150 * <li>PdfName.<b>USEOC</b> 151 * </ul> 152 * <li>In case the key is PdfName.DIRECTION, 153 * the value must be one of these names: 154 * <ul> 155 * <li>PdfName.<b>L2R</b> 156 * <li>PdfName.<b>R2L</b> 157 * </ul> 158 * <li>In case the key is one of these values: 159 * <ul> 160 * <li>PdfName.<b>VIEWAREA</b> 161 * <li>PdfName.<b>VIEWCLIP</b> 162 * <li>PdfName.<b>PRINTAREA</b> 163 * <li>PdfName.<b>PRINTCLIP</b> 164 * </ul> 165 * The value must be one of these names: 166 * <ul> 167 * <li>PdfName.<b>MEDIABOX</b> 168 * <li>PdfName.<b>CROPBOX</b> 169 * <li>PdfName.<b>BLEEDBOX</b> 170 * <li>PdfName.<b>TRIMBOX</b> 171 * <li>PdfName.<b>ARTBOX</b> 172 * </ul> 173 * <li>In case the key is PdfName.<b>PRINTSCALING</b>, the value can be 174 * <ul> 175 * <li>PdfName.<b>APPDEFAULT</b> 176 * <li>PdfName.<b>NONE</b> 177 * </ul> 178 * <li>In case the key is PdfName.<b>DUPLEX</b>, the value can be: 179 * <ul> 180 * <li>PdfName.<b>SIMPLEX</b> 181 * <li>PdfName.<b>DUPLEXFLIPSHORTEDGE</b> 182 * <li>PdfName.<b>DUPLEXFLIPLONGEDGE</b> 183 * </ul> 184 * <li>In case the key is PdfName.<b>PICKTRAYBYPDFSIZE</b>, the value must be of type PdfBoolean. 185 * <li>In case the key is PdfName.<b>PRINTPAGERANGE</b>, the value must be of type PdfArray. 186 * <li>In case the key is PdfName.<b>NUMCOPIES</b>, the value must be of type PdfNumber. 187 * <ul> 188 * </ul> 189 * @param key the name of the viewer preference 190 * @param value the value of the viewer preference 191 * @see PdfViewerPreferences#setViewerPreferences 192 */ 193 public void addViewerPreference(PdfName key, PdfObject value); 194}