⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pdfaction.java

📁 Java生成PDF Java生成PDF Java生成PDF
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
// $Id: PDFAction.java,v 1.3 2003/10/06 12:40:07 mike Exp $package org.faceless.pdf;import java.util.*;/** * <p> * An action tells the PDF viewer how to navigate around the document. * Actions are performed when the user clicks on a <code>PDFBookmark</code>, * when a {@link Form} element specifies an event, or optionally when a * document is opened (if the PDF's <code>setOpenAction</code> method is called). * </p><p> * The <code>PDFAction</code> class has no public constructor, just a number of * static methods returning a new action of the specified type. * </p> * @version $Revision: 1.3 $ */public final class PDFAction extends PeeredObject{    /**     * Method for the {@link #formSubmit} action specifying that the form should     * be submitted as a standard HTTP GET, in the same way as an HTML form.      * <i><b>Note:</b> we've recently found some problems with submission via an     * HTTP GET - specifically it doesn't work from a browser with Acrobat 5.     * For this reason we strongly recommend using {@link #METHOD_HTTP_POST}     * instead</i>     */    public static final int METHOD_HTTP_GET = 4+8;    /**     * Method for the {@link #formSubmit} action specifying that the form should     * be submitted as a standard HTTP GET, in the same way as an HTML form. The     * co-ordinates where the submit button was clicked are included in the     * submission as <i>name.x</i> and <i>name.y</i>, where name is the name of     * the submit button that was clicked.     * </p><p>     * <i><b>Note:</b> we've recently found some problems with submission via an     * HTTP GET - specifically it doesn't work from a browser with the Acrobat 5     * plugin. For this reason we strongly recommend using     * {@link #METHOD_HTTP_IMAGEMAP_POST} instead</i>     * </p>     */    public static final int METHOD_HTTP_IMAGEMAP_GET = 4+8+16;    /**     * Method for the {@link #formSubmit} action specifying that the form should     * be submitted as a standard HTTP POST, in the same way as an HTML form     */    public static final int METHOD_HTTP_POST = 4;    /**     * Method for the {@link #formSubmit} action specifying that the form should     * be submitted as a standard HTTP POST, in the same way as an HTML form. The     * co-ordinates where the submit button was clicked are included in the     * submission as <i>name.x</i> and <i>name.y</i>, where name is the name of     * the submit button that was clicked.     */    public static final int METHOD_HTTP_IMAGEMAP_POST = 4+16;    /**     * Method for the {@link #formSubmit} action specifying that the form should     * be submitted in the Adobe Forms Data Format.     */    public static final int METHOD_FDF = 0;    /**     * Method for the {@link #formSubmit} action specifying that the form should     * be submitted as XML.     * This method requires PDF 1.4 (Acrobat 5.0) or later.     */    public static final int METHOD_XML = 32;    /**     * Method for the {@link #formSubmit} action specifying that the form should     * be submitted in the Adobe Forms Data Format, and that it should include     * all the annotations in the document.     * This method requires PDF 1.4 (Acrobat 5.0) or later.     */    public static final int METHOD_FDF_WITH_ALL_ANNOTATIONS = 128;    /**     * Method for the {@link #formSubmit} action specifying that the form should     * be submitted in the Adobe Forms Data Format, and that it should include     * any annotations that have been created by the "current user". The spec is     * a bit vague on how the current user is determined, but we include this method     * for completeness.     * This method requires PDF 1.4 (Acrobat 5.0) or later.     */    public static final int METHOD_FDF_WITH_MY_ANNOTATIONS = 128+1024;        /**     * Method for the {@link #formSubmit} action specifying that the form should     * be submitted as a PDF.     * This method requires PDF 1.4 (Acrobat 5.0) or later.     */    public static final int METHOD_PDF = 256;    final org.faceless.pdf2.PDFAction action;    PDFAction(org.faceless.pdf2.PDFAction action)    {        this.action=action;    }    Object getPeer()    {        return action;    }    /**     * Return a new PDFAction which jumps to the specified page in the     * PDF document. The position and zoom on the new page is the same     * as that of the original page.     * @param page the page this action should jump to     */    public static PDFAction goTo(PDFPage page)    {	return new PDFAction(org.faceless.pdf2.PDFAction.goTo(page.page));    }    /**     * Return a new PDFAction which jumps to the specified page in the     * PDF document, at the specified x, y and zoom level.     * @param page the page this action should jump to.     * @param x the X position on the new page to scroll to, or <code>Float.NaN</code> to keep the X position unchanged.     * @param x the Y position on the new page to scroll to, or <code>Float.NaN</code> to keep the Y position unchanged.     * @param zoom The zoom level. A value of 0 or <code>Float.NaN</code> leaves the zoom unchanged, 1 sets the zoom to 100%, 2 to 200% and so on.     */    public static PDFAction goTo(PDFPage page, float x, float y, float zoom)    {	return new PDFAction(org.faceless.pdf2.PDFAction.goTo(page.page,x,y,zoom));    }    /**     * Return a new PDFAction which jumps to the specified page in the PDF document. The     * zoom level is set so that the entire page fits within the viewers window.     *     * @param page the page this action should jump to     */    public static PDFAction goToFit(PDFPage page)    {	return new PDFAction(org.faceless.pdf2.PDFAction.goToFit(page.page));    }    /**     * Return a new PDFAction which jumps to the specified page in the PDF document. The     * zoom level is set so that the width of the page fits within the viewers window.     *     * @param page the page this action should jump to     * @param y if the page is too tall to fit in the windows, the Y position on the new     * page to scroll to.     */    public static PDFAction goToFitWidth(PDFPage page, float y)    {	return new PDFAction(org.faceless.pdf2.PDFAction.goToFitWidth(page.page,y));    }    /**     * Return a new PDFAction which jumps to the specified page in the PDF document. The     * zoom level is set so that the full height of the page fits within the viewers window.     *     * @param page The page this action should jump to.     * @param x if the page is too wide to fit in the windows, the X position on the new     * page to scroll to.     */    public static PDFAction goToFitHeight(PDFPage page, float x)    {	return new PDFAction(org.faceless.pdf2.PDFAction.goToFitHeight(page.page,x));    }    /**     * Return a new PDFAction which jumps to the specified page in the PDF document. The     * zoom level is set so that the rectangle specified fills the screen     *     * @param page the page this action should jump to     * @param left the left edge of the visible rectangle     * @param bottom the bottom edge of the visible rectangle     * @param width the width of the visible rectangle     * @param height the height of the visible rectangle     */    public static PDFAction goToFitRectangle(PDFPage page, float left, float bottom, float width, float height)    {	return new PDFAction(org.faceless.pdf2.PDFAction.goToFitRectangle(page.page,left,bottom,width,height));    }    /**     * Return a new PDFAction which jumps to the specified URL.     * @since 1.1     */    public static PDFAction goToURL(java.net.URL url)    {	return new PDFAction(org.faceless.pdf2.PDFAction.goToURL(url));    }    /**     * Return a new PDFAction which jumps to the specified URL. When used     * from a {@link PDFAnnotation}, the annotation rectangle is treated     * as a Server-Side ImageMap. So for example, if the user clicks 20 points     * from the left and 30 points from the top of the link rectangle, the     * URL that is loaded is <code>http://www.url.com/?20,30</code>.     * @since 1.1     */    public static PDFAction goToURL(java.net.URL url, boolean isImageMap)    {	return new PDFAction(org.faceless.pdf2.PDFAction.goToURL(url,isImageMap));    }    /**     * Return a new PDFAction which plays a {@link PDFSound} when activated.     * This simpler of the two playSound methods plays the sound once at full     * volume and with mixing turned off. See the {@link PDFSound} class     * for more information on limitations with sound in PDF documents.     * @since 1.1     */    public static PDFAction playSound(PDFSound sound)    {	return new PDFAction(org.faceless.pdf2.PDFAction.playSound(sound.sound));    }    /**     * Return a new PDFAction which plays a {@link PDFSound} when activated.     * @param sound the {@link PDFSound} to play.     * @param volume the volume of the sound, from 0 (off) to 100 (maximum)     * @param repeat whether to play the sound continuously or just once     * @param mix whether to mix the sound in with any other playing samples, or replace them     * @since 1.1     */    public static PDFAction playSound(PDFSound sound, int volume, boolean repeat, boolean mix)    {	return new PDFAction(org.faceless.pdf2.PDFAction.playSound(sound.sound, volume, repeat, mix));    }    /**     * <p>Return a new PDFAction which runs the named action. Named actions     * are PDF viewer dependent, so should be used with care. The following     * actions are among those known to work in Acrobat 3 and 4 readers, and     * loosely correspond to the equivalent actions available from the menus     * in Acrobat.     * </p>     * <ul>     * <li>Document Control<BR>     * <tt>Open Close Print GeneralInfo FontsInfo SecurityInfo Quit</tt>     * </li>     * <li>Document Navigation<BR>     * <tt>NextPage PrevPage FirstPage LastPage GoToPage</tt>     * </li>     * <li>Searching and Selecting<BR>     * <tt>Find FindAgain SelectAll Copy</tt>     * </li>     * <li>Display<BR>     * <tt>FullScreen ZoomTo FitPage ZoomTo ActualSize FitWidth     * FitVisible SinglePage OneColumn TwoColumns</tt>     * </li>     * </ul>     * @since 1.1     */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -