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

📄 pdfaction.java

📁 Java生成PDF Java生成PDF Java生成PDF
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    public static PDFAction named(String name)    {	return new PDFAction(org.faceless.pdf2.PDFAction.named(name));    }    /**     * Return a new PDFAction which makes the specified {@link FormElement}     * visible on screen.     * @param element the form element to modify     * @see #hideElement     * @since 1.1.23     */    public static PDFAction showElement(FormElement element)    {	return (PDFAction)PeeredObject.getPeer(org.faceless.pdf2.PDFAction.showWidget(element.element.getAnnotation(0)));    }    /**     * Return a new PDFAction which hides the specified {@link FormElement}.     * @param element the form element to modify     * @see #showElement     * @since 1.1.23     */    public static PDFAction hideElement(FormElement element)    {	return (PDFAction)PeeredObject.getPeer(org.faceless.pdf2.PDFAction.hideWidget(element.element.getAnnotation(0)));    }    /**     * Return a new PDFAction which submits the documents AcroForm. This should     * be used as the <code>ONCLICK</code> event for a {@link FormButton}     * somewhere in the form, so the form can be submitted.     * </p><p>     * The method parameter can be one of the various {@link #METHOD_HTTP_GET METHOD}     * values, although please note that many of these values are only implemented in     * Acrobat 5.0 or later.     * </p>     * @param url the URL to submit the form to     * @param method the method to use when submitting the form     * @since 1.1.23     * @see Form     */    public static PDFAction formSubmit(String url, int method)    {	int newmethod;	if (method==METHOD_FDF)				newmethod=org.faceless.pdf2.PDFAction.METHOD_FDF;	else if (method==METHOD_PDF)			newmethod=org.faceless.pdf2.PDFAction.METHOD_PDF;	else if (method==METHOD_HTTP_POST)		newmethod=org.faceless.pdf2.PDFAction.METHOD_HTTP_POST;	else if (method==METHOD_HTTP_IMAGEMAP_POST)	newmethod=org.faceless.pdf2.PDFAction.METHOD_HTTP_IMAGEMAP_POST;	else if (method==METHOD_XML)			newmethod=org.faceless.pdf2.PDFAction.METHOD_XML;	else if (method==METHOD_FDF_WITH_ALL_ANNOTATIONS)	newmethod=org.faceless.pdf2.PDFAction.METHOD_FDF_WITH_ALL_ANNOTATIONS;	else if (method==METHOD_FDF_WITH_MY_ANNOTATIONS)	newmethod=org.faceless.pdf2.PDFAction.METHOD_FDF_WITH_MY_ANNOTATIONS;	else throw new IllegalArgumentException("No such method type");	return new PDFAction(org.faceless.pdf2.PDFAction.formSubmit(url, newmethod));    }    /**     * Return a new <code>PDFAction</code> which resets the documents AcroForm,     * setting every field to its default values.     * @since 1.1.23     * @see Form     */    public static PDFAction formReset()    {	return new PDFAction(org.faceless.pdf2.PDFAction.formReset());    }    /**     * Return a new <code>PDFAction</code> which imports a Forms Data Format (FDF)     * file into the document AcroForm, setting some or all of the forms values.     * @param file the name of the file containing the FDF. The file is relative to     * the location of the current document     * @since 1.1.23     * @see Form     */    public static PDFAction formImportData(String file)    {	return new PDFAction(org.faceless.pdf2.PDFAction.formImportData(file));    }    /**     * <p>     * Return a new <code>PDFAction</code> which executes a JavaScript action.     * This is generally used with AcroForms, although in theory it doesn't     * have to be. It's generally better design to create functions in the     * document-wide JavaScript (as set by {@link PDF#setJavaScript}) and just     * use these actions to call those methods.     * </p>     * @param javascript the JavaScript action to perform     * @since 1.1.23     * @see PDF#setJavaScript     * @see PDF#getJavaScript     * @see Form     */    public static PDFAction formJavaScript(String javascript)    {	return new PDFAction(org.faceless.pdf2.PDFAction.formJavaScript(javascript));    }    /**     * The <code>setNext</code> method allows you to create "chains" of actions     * which are executed whenever the first entry in the chain is run. This     * allows more complicated processing - for example, clicking on a button     * could play a sound and then jump to a specific page.     * </p><p>     * Avoiding infinite action loops is the responsibility of the programmer.     * </p>     * @param action the action to execute after the current one, or     * <code>null</code> to clear it.     * @since 1.1     */    public void setNext(PDFAction a)    {	action.setNext(a==null ? null : a.action);    }    /**     * Return the action that's next in the chain after this one, or     * <code>null</code> if no further actions are defined.     * @since 1.1     */    public PDFAction getNext()    {	return (PDFAction)PeeredObject.getPeer(action.getNext());    }    /**     * <p>     * Return the type of action. Can be "Named:<i>value</i>" (where "value" is the     * named action that's performed), "URL", "Sound", "GoTo",      * "GoToFitRectangle", "GoToFit", "GoToFitHeight", "GoToFitWidth",     * "ShowElement", "HideElement", "FormReset", "FormImportData", "FormSubmit",     * "FormJavaScript" or one of another type of action supported by     * the PDF specification but not by this library ("Launch", "Thread" or "Movie").     * </p><p>     * Note since 1.1.23 the URL value no longer includes the URL being referenced - use     * the {@link #getURL} method to retrieve that value     * </p>     * @return the type of action this object represents     * @since 1.1.12     */    public String getType()    {	return action.getType();    }    /**     * For actions that refer to a page - any of the "GoTo" actions except "GoToURL" -     * return the page the action refers to. For other types of action, returns     * <tt>null</tt>.     * @return the page this action refers to, or <tt>null</tt> if not applicable.     * @since 1.1.12     */    public PDFPage getPage()    {	return (PDFPage)PeeredObject.getPeer(action.getPage());    }    /**     * For "Sound" actions, return the PDFSound object this action refers to.     * For other types of action this returns <tt>null</tt>     * @return the sound this action refers to, or <tt>null</tt> if not applicable.     * @since 1.1.12     */    public PDFSound getSound()    {	return (PDFSound)PeeredObject.getPeer(action.getSound());    }    /**     * For <code>toggleAnnotation</code> type annotations,     * return the annotation that is being toggled.     * @return the annotation this action refers to, or <tt>null</tt> if not applicable.     * @since 1.1.22     */    public PDFAnnotation getAnnotation()    {	return (PDFAnnotation)PeeredObject.getPeer(action.getAnnotation());    }    /**     * For <code>JavaScript</code> type annotations, return the JavaScript     * that is being executed. For other annotations, return <code>null</code>.     * @return the JavaScript that is executed or <tt>null</tt> if not applicable.     * @since 1.1.23     */    public String getJavaScript()    {	return action.getJavaScript();    }    /**     * For <tt>formSubmit</tt>, <tt>goToURL</tt> and <tt>formImportData</tt>     * actions, return the URL that is the destination of the action (or source     * of the data). For other annotations, return <code>null</code>     * @return the URL of the action     * @since 1.1.23     */    public String getURL()    {	return action.getURL();    }    /**     * For <tt>formSubmit</tt> actions, return the method by which the     * form is submitted - one of the {@link #METHOD_HTTP_GET METHOD} parameters     * defined in this class. For other action types the return is -1     * @return the submit method for this <code>formSubmit</code> action     * @since 1.1.23     */    public int getFormSubmitMethod()    {	return action.getFormSubmitMethod();    }    /**     * Return the co-ordinates of a GoTo action. Some "GoTo" actions take     * one or more coordinates which determine which section of the specified     * page should be displayed. Examples of this are the     * {@link #goToFitRectangle goToFitRectangle} method, which takes four parameters,     * and the {@link #goToFitWidth goToFitWidth} method, which takes one. These     * coordinates can be read by calling this method, which returns an array     * of floats, the length of which varies depending on the type of GoTo     * action. Specifically, "GoToFitWidth" and "GoToFitHeight" methods     * return an array of one float, "GoToFitRectangle" will return four and     * "GoTo" will return three. For this last one, the first number represents     * the "X" coordinate, the second the "Y" and the third the zoom level, but     * it's important to remember that any one of these may be unspecified -     * in this case the value is set to <code>Float.NaN</code>.     * @since 1.2     */    public float[] getGoToCoordinates()    {	return action.getGoToCoordinates();    }    public String toString()    {	String t = getType();	String out = "<action type=\""+t+"\"";	if (getJavaScript()!=null) out+=" javascript=\""+getJavaScript()+"\"";	if (getSound()!=null) out+=" sound=\""+getSound()+"\"";	if (getPage()!=null) out+=" page=\""+getPage()+"\"";	if (getNext()!=null) out+=" next=\""+getNext()+"\"";	float[] f = getGoToCoordinates();	if (f.length>0) {	    out+=" coords=";	    for (int i=0;i<f.length;i++) {	        out += (i==0 ? "\"" : ",")+f[i];	    }	    out+="\"";	}	return out+"/>";    }}

⌨️ 快捷键说明

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