001/*
002 * $Id: DocListener.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;
045
046/**
047 * A class that implements <CODE>DocListener</CODE> will perform some
048 * actions when some actions are performed on a <CODE>Document</CODE>.
049 *
050 * @see         ElementListener
051 * @see         Document
052 * @see         DocWriter
053 */
054
055public interface DocListener extends ElementListener {
056    
057    // methods
058    
059        /**
060         * Signals that the <CODE>Document</CODE> has been opened and that
061         * <CODE>Elements</CODE> can be added.
062         */
063    
064    public void open(); // [L1]
065    
066    /**
067     * Signals that the <CODE>Document</CODE> was closed and that no other
068     * <CODE>Elements</CODE> will be added.
069     * <P>
070     * The outputstream of every writer implementing <CODE>DocListener</CODE> will be closed.
071     */
072        
073    public void close(); // [L2] 
074    
075    /**
076     * Signals that an new page has to be started.
077     *
078     * @return  <CODE>true</CODE> if the page was added, <CODE>false</CODE> if not.
079     */
080        
081    public boolean newPage(); // [L3]
082    
083    /**
084     * Sets the pagesize.
085     *
086     * @param   pageSize        the new pagesize
087     * @return  a <CODE>boolean</CODE>
088     */
089        
090    public boolean setPageSize(Rectangle pageSize); // [L4]
091        
092    /**
093     * Sets the margins.
094     *
095     * @param   marginLeft              the margin on the left
096     * @param   marginRight             the margin on the right
097     * @param   marginTop               the margin on the top
098     * @param   marginBottom    the margin on the bottom
099     * @return  a <CODE>boolean</CODE>
100     */
101        
102    public boolean setMargins(float marginLeft, float marginRight, float marginTop, float marginBottom);  // [L5]
103        
104    /**
105     * Parameter that allows you to do left/right  margin mirroring (odd/even pages)
106     * @param marginMirroring
107     * @return true if successful
108     */
109    public boolean setMarginMirroring(boolean marginMirroring); // [L6]
110    
111    /**
112     * Parameter that allows you to do top/bottom margin mirroring (odd/even pages)
113     * @param marginMirroringTopBottom
114     * @return true if successful
115     * @since   2.1.6
116     */
117    public boolean setMarginMirroringTopBottom(boolean marginMirroringTopBottom); // [L6]
118        
119    /**
120     * Sets the page number.
121     *
122     * @param   pageN           the new page number
123     */
124        
125    public void setPageCount(int pageN); // [L7]
126    
127    /**
128     * Sets the page number to 0.
129     */
130        
131    public void resetPageCount(); // [L8]
132
133}