📄 pageformatfactory.java
字号:
/**
* ========================================
* JFreeReport : a free Java report library
* ========================================
*
* Project Info: http://www.jfree.org/jfreereport/index.html
* Project Lead: Thomas Morgner;
*
* (C) Copyright 2000-2002, by Simba Management Limited and Contributors.
*
* This library is free software; you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* -----------------------
* PageFormatFactory.java
* -----------------------
* (C)opyright 2000-2002, by Simba Management Limited.
*
* $Id: PageFormatFactory.java,v 1.5.2.1 2003/12/21 23:29:20 taqua Exp $
*
* Changes
* -------
* 27-Jul-2002 : Initial version, empty class :(
* 26-Aug-2002 : Coded all defined Postscript-PaperFormats as defined by Adobe.
* 30-Aug-2002 : Added method to define the paper using a String constant referring to a constant
* defined in the class.
* 25-Sep-2002 : Fixed bug 613846 (Javadoc) (DG);
* 12-Dec-2002 : Documentation
* 30-Jan-2003 : Added methods to calculate the border size of a Paper object
* 05-Feb-2003 : Added Serialization Support for PageFormats.
*/
package org.jfree.report.util;
import java.awt.print.PageFormat;
import java.awt.print.Paper;
import java.lang.reflect.Field;
/**
* The PageFormatFactory is used to create PageFormats on a higher level. The Factory contains
* templates for all PageSizes defined by Adobe:
* <p>
* <a href="http://partners.adobe.com/asn/developer/pdfs/tn/5003.PPD_Spec_v4.3.pdf"
* >Postscript Specifications</a>
* <p>
* Usage for creating an printjob on A4 paper with 2.5 cm border:
* <code>
* Paper paper = PageFormatFactory.createPaper (PageFormatFactory.A4);
* PageFormatFactory.setBordersMm (paper, 25, 25, 25, 25);
* PageFormat format = PageFormatFactory.createPageFormat (paper, PageFormat.PORTRAIT);
* </code>
*
* @author Thomas Morgner
*/
public final class PageFormatFactory
{
/** Constant for dots per inch. */
public static final int DOTS_PER_INCH = 72;
/** A standard paper size. */
public static final int[] PAPER11X17 = {792, 1224};
/** A standard paper size. */
public static final int[] PAPER10X11 = {720, 792};
/** A standard paper size. */
public static final int[] PAPER10X13 = {720, 936};
/** A standard paper size. */
public static final int[] PAPER10X14 = {720, 1008};
/** A standard paper size. */
public static final int[] PAPER12X11 = {864, 792};
/** A standard paper size. */
public static final int[] PAPER15X11 = {1080, 792};
/** A standard paper size. */
public static final int[] PAPER7X9 = {504, 648};
/** A standard paper size. */
public static final int[] PAPER8X10 = {576, 720};
/** A standard paper size. */
public static final int[] PAPER9X11 = {648, 792};
/** A standard paper size. */
public static final int[] PAPER9X12 = {648, 864};
/** A standard paper size. */
public static final int[] A0 = {2384, 3370};
/** A standard paper size. */
public static final int[] A1 = {1684, 2384};
/** A standard paper size. */
public static final int[] A2 = {1191, 1684};
/** A standard paper size. */
public static final int[] A3 = {842, 1191};
/** A standard paper size. */
public static final int[] A3_TRANSVERSE = {842, 1191};
/** A standard paper size. */
public static final int[] A3_EXTRA = {913, 1262};
/** A standard paper size. */
public static final int[] A3_EXTRATRANSVERSE = {913, 1262};
/** A standard paper size. */
public static final int[] A3_ROTATED = {1191, 842};
/** A standard paper size. */
public static final int[] A4 = {595, 842};
/** A standard paper size. */
public static final int[] A4_TRANSVERSE = {595, 842};
/** A standard paper size. */
public static final int[] A4_EXTRA = {667, 914};
/** A standard paper size. */
public static final int[] A4_PLUS = {595, 936};
/** A standard paper size. */
public static final int[] A4_ROTATED = {842, 595};
/** A standard paper size. */
public static final int[] A4_SMALL = {595, 842};
/** A standard paper size. */
public static final int[] A5 = {420, 595};
/** A standard paper size. */
public static final int[] A5_TRANSVERSE = {420, 595};
/** A standard paper size. */
public static final int[] A5_EXTRA = {492, 668};
/** A standard paper size. */
public static final int[] A5_ROTATED = {595, 420};
/** A standard paper size. */
public static final int[] A6 = {297, 420};
/** A standard paper size. */
public static final int[] A6_ROTATED = {420, 297};
/** A standard paper size. */
public static final int[] A7 = {210, 297};
/** A standard paper size. */
public static final int[] A8 = {148, 210};
/** A standard paper size. */
public static final int[] A9 = {105, 148};
/** A standard paper size. */
public static final int[] A10 = {73, 105};
/** A standard paper size. */
public static final int[] ANSIC = {1224, 1584};
/** A standard paper size. */
public static final int[] ANSID = {1584, 2448};
/** A standard paper size. */
public static final int[] ANSIE = {2448, 3168};
/** A standard paper size. */
public static final int[] ARCHA = {648, 864};
/** A standard paper size. */
public static final int[] ARCHB = {864, 1296};
/** A standard paper size. */
public static final int[] ARCHC = {1296, 1728};
/** A standard paper size. */
public static final int[] ARCHD = {1728, 2592};
/** A standard paper size. */
public static final int[] ARCHE = {2592, 3456};
/** A standard paper size. */
public static final int[] B0 = {2920, 4127};
/** A standard paper size. */
public static final int[] B1 = {2064, 2920};
/** A standard paper size. */
public static final int[] B2 = {1460, 2064};
/** A standard paper size. */
public static final int[] B3 = {1032, 1460};
/** A standard paper size. */
public static final int[] B4 = {729, 1032};
/** A standard paper size. */
public static final int[] B4_ROTATED = {1032, 729};
/** A standard paper size. */
public static final int[] B5 = {516, 729};
/** A standard paper size. */
public static final int[] B5_TRANSVERSE = {516, 729};
/** A standard paper size. */
public static final int[] B5_ROTATED = {729, 516};
/** A standard paper size. */
public static final int[] B6 = {363, 516};
/** A standard paper size. */
public static final int[] B6_ROTATED = {516, 363};
/** A standard paper size. */
public static final int[] B7 = {258, 363};
/** A standard paper size. */
public static final int[] B8 = {181, 258};
/** A standard paper size. */
public static final int[] B9 = {127, 181};
/** A standard paper size. */
public static final int[] B10 = {91, 127};
/** A standard paper size. */
public static final int[] C4 = {649, 918};
/** A standard paper size. */
public static final int[] C5 = {459, 649};
/** A standard paper size. */
public static final int[] C6 = {323, 459};
/** A standard paper size. */
public static final int[] COMM10 = {297, 684};
/** A standard paper size. */
public static final int[] DL = {312, 624};
/** A standard paper size. */
public static final int[] DOUBLEPOSTCARD = {567, 419}; // should be 419.5, but I ignore that..
/** A standard paper size. */
public static final int[] DOUBLEPOSTCARD_ROTATED = {419, 567};
/** A standard paper size. */
public static final int[] ENV9 = {279, 639};
/** A standard paper size. */
public static final int[] ENV10 = {297, 684};
/** A standard paper size. */
public static final int[] ENV11 = {324, 747};
/** A standard paper size. */
public static final int[] ENV12 = {342, 792};
/** A standard paper size. */
public static final int[] ENV14 = {360, 828};
/** A standard paper size. */
public static final int[] ENVC0 = {2599, 3676};
/** A standard paper size. */
public static final int[] ENVC1 = {1837, 2599};
/** A standard paper size. */
public static final int[] ENVC2 = {1298, 1837};
/** A standard paper size. */
public static final int[] ENVC3 = {918, 1296};
/** A standard paper size. */
public static final int[] ENVC4 = {649, 918};
/** A standard paper size. */
public static final int[] ENVC5 = {459, 649};
/** A standard paper size. */
public static final int[] ENVC6 = {323, 459};
/** A standard paper size. */
public static final int[] ENVC65 = {324, 648};
/** A standard paper size. */
public static final int[] ENVC7 = {230, 323};
/** A standard paper size. */
public static final int[] ENVCHOU3 = {340, 666};
/** A standard paper size. */
public static final int[] ENVCHOU3_ROTATED = {666, 340};
/** A standard paper size. */
public static final int[] ENVCHOU4 = {255, 581};
/** A standard paper size. */
public static final int[] ENVCHOU4_ROTATED = {581, 255};
/** A standard paper size. */
public static final int[] ENVDL = {312, 624};
/** A standard paper size. */
public static final int[] ENVINVITE = {624, 624};
/** A standard paper size. */
public static final int[] ENVISOB4 = {708, 1001};
/** A standard paper size. */
public static final int[] ENVISOB5 = {499, 709};
/** A standard paper size. */
public static final int[] ENVISOB6 = {499, 354};
/** A standard paper size. */
public static final int[] ENVITALIAN = {312, 652};
/** A standard paper size. */
public static final int[] ENVELOPE = {312, 652};
/** A standard paper size. */
public static final int[] ENVKAKU2 = {680, 941};
/** A standard paper size. */
public static final int[] ENVKAKU2_ROTATED = {941, 680};
/** A standard paper size. */
public static final int[] ENVKAKU3 = {612, 785};
/** A standard paper size. */
public static final int[] ENVKAKU3_ROTATED = {785, 612};
/** A standard paper size. */
public static final int[] ENVMONARCH = {279, 540};
/** A standard paper size. */
public static final int[] ENVPERSONAL = {261, 468};
/** A standard paper size. */
public static final int[] ENVPRC1 = {289, 468};
/** A standard paper size. */
public static final int[] ENVPRC1_ROTATED = {468, 289};
/** A standard paper size. */
public static final int[] ENVPRC2 = {289, 499};
/** A standard paper size. */
public static final int[] ENVPRC2_ROTATED = {499, 289};
/** A standard paper size. */
public static final int[] ENVPRC3 = {354, 499};
/** A standard paper size. */
public static final int[] ENVPRC3_ROTATED = {499, 354};
/** A standard paper size. */
public static final int[] ENVPRC4 = {312, 590};
/** A standard paper size. */
public static final int[] ENVPRC4_ROTATED = {590, 312};
/** A standard paper size. */
public static final int[] ENVPRC5 = {312, 624};
/** A standard paper size. */
public static final int[] ENVPRC5_ROTATED = {624, 312};
/** A standard paper size. */
public static final int[] ENVPRC6 = {340, 652};
/** A standard paper size. */
public static final int[] ENVPRC6_ROTATED = {652, 340};
/** A standard paper size. */
public static final int[] ENVPRC7 = {454, 652};
/** A standard paper size. */
public static final int[] ENVPRC7_ROTATED = {652, 454};
/** A standard paper size. */
public static final int[] ENVPRC8 = {340, 876};
/** A standard paper size. */
public static final int[] ENVPRC8_ROTATED = {876, 340};
/** A standard paper size. */
public static final int[] ENVPRC9 = {649, 918};
/** A standard paper size. */
public static final int[] ENVPRC9_ROTATED = {918, 649};
/** A standard paper size. */
public static final int[] ENVPRC10 = {918, 1298};
/** A standard paper size. */
public static final int[] ENVPRC10_ROTATED = {1298, 918};
/** A standard paper size. */
public static final int[] ENVYOU4 = {298, 666};
/** A standard paper size. */
public static final int[] ENVYOU4_ROTATED = {666, 298};
/** A standard paper size. */
public static final int[] EXECUTIVE = {522, 756};
/** A standard paper size. */
public static final int[] FANFOLDUS = {1071, 792};
/** A standard paper size. */
public static final int[] FANFOLDGERMAN = {612, 864};
/** A standard paper size. */
public static final int[] FANFOLDGERMANLEGAL = {612, 936};
/** A standard paper size. */
public static final int[] FOLIO = {595, 935};
/** A standard paper size. */
public static final int[] ISOB0 = {2835, 4008};
/** A standard paper size. */
public static final int[] ISOB1 = {2004, 2835};
/** A standard paper size. */
public static final int[] ISOB2 = {1417, 2004};
/** A standard paper size. */
public static final int[] ISOB3 = {1001, 1417};
/** A standard paper size. */
public static final int[] ISOB4 = {709, 1001};
/** A standard paper size. */
public static final int[] ISOB5 = {499, 709};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -