|
||
| Home Products Purchase Downloads Demos Forums Blogs Ticket Wiki API Corporate | ||
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.aspose.pdf.kit.Form
Represents a class which is used to modify AcroForms Field in existing pdf documents. Various form fields can be easily modified or flattened with APIs, including: -text field -list box field -combo box field -radio button box field -check box field Additionally, image button field can be filled with a specified image. It can be used like this:
//Open the document and create a Form object like this:
Form form = new Form("Online.pdf", "output.pdf");
//Add a logo field at the top of each page like this:
form.setWaterMark("newwatermark.jpg");
//Fill a text field like this:
form.setField("fullName", "Luke Fu");
//Select a radio button like this:
form.setField("gender", "male");
//Paste a image onto the existing button field like this:
form.fillImageField("photo", "watermark.jpg");
//Choose a item from a combe box field like this:
form.setField("bankList", "list Item3");
//Choose a item from a list field like this:
form.setField("period", "1 year");
//Select a ckeck box like this:
form.setField("pay", "Yes");
//Flatten all the fields like this:
//form.allFlatten();
//Close the document like this:
form.close();
| Field Summary | |
static int |
ATTR_NO_EXPORT
If set, the field must not be exported by a submit-form action. |
static int |
ATTR_READ_ONLY
If set, the user may not change the value of the field. |
static int |
ATTR_REQUIRED
If set, this field must have a value at the time it is exported by a submit-form field, otherwise errors will occur. |
static int |
FLAG_HIDDEN
If set, do not display or print the field or allow it to interact with the user. |
static int |
FLAG_LOCKED
If set, lock the field, not allowing it to be deleted or its properties to be modified by the user, such as position and size. |
static int |
FLAG_NOROTATE
If set, do not rotate the fieldĄ¯s appearance to match the rotation of the page. |
static int |
FLAG_NOVIEW
If set, do not display the field on the screen or allow it to interact with the user. |
static int |
FLAG_NOZOOM
If set, do not scale the fieldĄ¯s appearance to match the magnification of the page. |
static int |
FLAG_PRINT
If set, print the field when the page is printed. |
static int |
FLAG_READONLY
If set, do not allow the field to interact with the user. |
static int |
FLAG_TOGGLENOVIEW
If set, invert the interpretation of the NoView flag for certain events. |
| Constructor Summary | |
Form()
Represents a constructor of the Form object without any parameter |
|
Form(java.io.InputStream srcStream,
java.io.OutputStream dstStream)
Represents a constructor of the Form object with source stream and destination stream. |
|
Form(java.io.InputStream srcStream,
java.lang.String desFilename)
Represents a constructor of the Form object with source stream and destination file. |
|
Form(java.lang.String srcFilename)
Represents a constructor of the Form object with only a source file. |
|
Form(java.lang.String srcFilename,
java.io.OutputStream dstStream)
Represents a constructor of the Form object with source file and destination stream. |
|
Form(java.lang.String srcFilename,
java.lang.String desFilename)
Represents a constructor of the Form object with source file and destination file. |
|
| Method Summary | |
void |
allFlatten()
Flattens all fields in the specified pdf document. |
void |
close()
Saves all the modifications and closes the destination file. |
void |
exportFdf(java.lang.String pdfFilename,
java.io.OutputStream fdfStream)
Exports the content of the fields in source PDF into a FDF stream. |
void |
exportFdf(java.lang.String pdfFilename,
java.lang.String fdfFilename)
Exports the content of the fields in PDF into a FDF file. |
void |
exportXfdf(java.lang.String pdfFilename,
java.io.OutputStream xfdfOutputStream)
Exports the content of the fields in PDF into a XFDF stream. |
void |
exportXfdf(java.lang.String pdfFilename,
java.lang.String xfdfFilename)
Exports the content of the fields in PDF into a XFDF file. |
void |
exportXml(java.io.OutputStream xmlOutputStream)
Export field information to a standard XML stream. |
void |
exportXml(java.lang.String xmlOutputFile)
Export field information to a standard XML file. |
void |
fillImageField(java.lang.String fieldName,
java.lang.String imageFilename)
Pastes an image onto the existing button field as its appearance. |
java.lang.String[] |
getFieldsNames()
Gets the names of all the fields contained in the PDF document. |
int |
getFieldType(java.lang.String fieldName)
The getter of the type of the specified field. |
java.lang.String |
getFieldValue(java.lang.String fieldName)
Gets the field's value according to its field name. |
java.io.OutputStream |
getOutputStream()
The getter of the output stream member. |
void |
importFdf(java.io.InputStream fdfStream)
Imports the content of fields from a FDF stream into a PDF template to generate a new PDF document. |
void |
importFdf(java.lang.String fdfFilename)
Imports the content of fields from a FDF file into a PDF template to generate a new PDF document. |
void |
importXfdf(java.io.InputStream xfdfInputStream)
Imports the content of fields from a XFDF stream into a PDF template to generate a new PDF document. |
void |
importXfdf(java.lang.String xfdfFilename)
Imports the content of fields from a XFDF stream into a PDF template to generate a new PDF document. |
void |
importXml(java.io.InputStream xmlInputStream)
Import information from a standard XML stream to a PDF template, producing a PDF document. |
void |
importXml(java.lang.String xmlInputFile)
Import information from a standard XML file to a PDF template, producing a PDF document. |
void |
moveTo(java.lang.String fieldName,
float right,
float up)
Deprecated. |
void |
moveTo(java.lang.String fieldName,
float llx,
float lly,
float urx,
float ury)
Deprecated. |
void |
partialFlatten(java.lang.String fieldName)
Flattens part of the fields set in the specified pdf document. |
void |
setField(java.lang.String fieldName,
java.lang.String value)
Modifies the value of an existing field according to a specified field name. |
void |
setFieldAttr(java.lang.String fieldName,
int flag)
Deprecated. |
void |
setFieldFlag(java.lang.String fieldName,
int flag)
Deprecated. |
void |
setSubmitBtnUrl(java.lang.String fieldName,
java.lang.String url)
Deprecated. |
void |
setWaterMark(java.lang.String imageFilename)
Inserts an appointed watermark or logo field at the top of the pdf document. |
void |
zoom(java.lang.String fieldName,
float scale)
Deprecated. |
void |
zoom(java.lang.String fieldName,
float scaleLength,
float scaleWidth)
Deprecated. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int FLAG_HIDDEN
public static final int FLAG_PRINT
public static final int FLAG_NOZOOM
public static final int FLAG_NOROTATE
public static final int FLAG_NOVIEW
public static final int FLAG_READONLY
public static final int FLAG_LOCKED
public static final int FLAG_TOGGLENOVIEW
public static final int ATTR_READ_ONLY
public static final int ATTR_REQUIRED
public static final int ATTR_NO_EXPORT
| Constructor Detail |
public Form()
throws java.lang.Exception
java.lang.Exception - On errers.
public Form(java.lang.String srcFilename)
throws java.lang.Exception
srcFilename - The path of the input pdf file.
java.lang.Exception - On errers.
public Form(java.lang.String srcFilename,
java.lang.String desFilename)
throws java.lang.Exception
srcFilename - The path of the input pdf file.desFilename - The path of the output pdf file.
java.lang.Exception - On error.
public Form(java.lang.String srcFilename,
java.io.OutputStream dstStream)
throws java.lang.Exception
srcFilename - The path of the input pdf file.dstStream - The path of the output stream.
java.lang.Exception - On error.
public Form(java.io.InputStream srcStream,
java.io.OutputStream dstStream)
throws java.lang.Exception
srcStream - The path of the input stream.dstStream - The path of the output stream.
java.lang.Exception - On error.
public Form(java.io.InputStream srcStream,
java.lang.String desFilename)
throws java.lang.Exception
srcStream - The path of the input stream.desFilename - The path of the pdf file.
java.lang.Exception - On error.| Method Detail |
public void setField(java.lang.String fieldName,
java.lang.String value)
throws java.lang.Exception
fieldName - The fully qualified field name.value - The value to be appointed.
java.lang.Exception
public void setSubmitBtnUrl(java.lang.String fieldName,
java.lang.String url)
throws java.lang.Exception
fieldName - The fully qualified field name.url - The destination to be assigned.
java.lang.Exception - On error.
public void setFieldFlag(java.lang.String fieldName,
int flag)
throws java.lang.Exception
fieldName - The fully qualified field name.flag - The appearance flag to be set, must be Form.FLAG_*.
java.lang.Exception - On error.
public void setFieldAttr(java.lang.String fieldName,
int flag)
throws java.lang.Exception
fieldName - The fully qualified field name.flag - The attribute flag to be set, must be Form.ATTR_*.
java.lang.Exception - On error.
public void moveTo(java.lang.String fieldName,
float llx,
float lly,
float urx,
float ury)
throws java.lang.Exception
fieldName - The fully qualified field name.llx - The abscissa of the field's low left vertex.lly - The ordinate of the field's low left vertex.urx - The abscissa of the field's up right vertex.ury - The ordinate of the field's up right vertex.
java.lang.Exception - On error.
public void moveTo(java.lang.String fieldName,
float right,
float up)
throws java.lang.Exception
fieldName - The fully qualified field name.right - The relative offset of abscissa, positive referring to move right,
and negative referring to move left.up - The relative offset of ordinate, positive referring to move up,
and negative referring to move down.
java.lang.Exception - On error.
public void zoom(java.lang.String fieldName,
float scaleLength,
float scaleWidth)
throws java.lang.Exception
fieldName - The fully qualified field name.scaleLength - The scale for length zooming only, must be positive.scaleWidth - The scale for width zooming only, must be positive.
java.lang.Exception - On error.
public void zoom(java.lang.String fieldName,
float scale)
throws java.lang.Exception
fieldName - The fully qualified field name.scale - The scale to zoom, both for the length and width.
java.lang.Exception - On error.
public void partialFlatten(java.lang.String fieldName)
throws java.lang.Exception
fieldName - The fully qualified field name.
java.lang.Exception - On flattening error.
public void allFlatten()
throws java.lang.Exception
java.lang.Exception - On flattening error.
public void close()
throws java.lang.Exception
java.lang.Exception - On closing error.
public java.io.OutputStream getOutputStream()
throws java.lang.Exception
java.lang.Exception - On error.public int getFieldType(java.lang.String fieldName)
fieldName - The fully qualified field name.
public java.lang.String[] getFieldsNames()
public java.lang.String getFieldValue(java.lang.String fieldName)
fieldName - The fully qualified field name.
public void fillImageField(java.lang.String fieldName,
java.lang.String imageFilename)
throws PdfKitException,
java.io.IOException
fieldName - The fully qualified field name of the image button field.imageFilename - The path of the image file, relative and absolute are both ok.
PdfKitException
java.io.IOException
public void setWaterMark(java.lang.String imageFilename)
throws java.net.MalformedURLException,
java.io.IOException,
com.aspose.pdf.kit.BadElementException,
PdfKitException
imageFilename - The path of the watermark image or logo file,
relative and absolute are both ok.
java.net.MalformedURLException
java.io.IOException
com.aspose.pdf.kit.BadElementException
PdfKitException
public void exportFdf(java.lang.String pdfFilename,
java.io.OutputStream fdfStream)
throws java.lang.Exception
pdfFilename - the name of the PDF document.fdfStream - the name of the destination FDF stream.
java.lang.Exception - On export error.
public void exportFdf(java.lang.String pdfFilename,
java.lang.String fdfFilename)
throws java.lang.Exception
pdfFilename - the name of the source PDF document.fdfFilename - the name of the destination FDF file.
java.lang.Exception - On export error.
public void importFdf(java.io.InputStream fdfStream)
throws PdfKitException,
java.io.IOException
fdfStream - the name of the source FDF stream.
PdfKitException - On error.
java.io.IOException - On error.
public void importFdf(java.lang.String fdfFilename)
throws PdfKitException,
java.io.IOException
fdfFilename - the name of the source FDF file.
PdfKitException - On error.
java.io.IOException - On error.
public void exportXfdf(java.lang.String pdfFilename,
java.lang.String xfdfFilename)
throws java.lang.Exception
pdfFilename - the name of the source PDF document.xfdfFilename - the name of the destination XFDF file.
java.lang.Exception - On export error.
public void exportXfdf(java.lang.String pdfFilename,
java.io.OutputStream xfdfOutputStream)
throws java.lang.Exception
pdfFilename - the name of the source PDF document.xfdfOutputStream - the name of the destination XFDF stream.
java.lang.Exception - On export error.
public void importXfdf(java.lang.String xfdfFilename)
throws java.lang.Exception
xfdfFilename - the name of the source XFDF file.
java.lang.Exception - On import error.
public void importXfdf(java.io.InputStream xfdfInputStream)
throws java.lang.Exception
xfdfInputStream - the name of the source XFDF file.
java.lang.Exception - On import error.
public void importXml(java.lang.String xmlInputFile)
throws java.lang.Exception
xmlInputFile - the name of the input XML file.
java.lang.Exception - On errors.
public void importXml(java.io.InputStream xmlInputStream)
throws java.lang.Exception
xmlInputStream - the name of the input XML stream.
java.lang.Exception - On errors.
public void exportXml(java.lang.String xmlOutputFile)
throws java.lang.Exception
xmlOutputFile - the name of the output XML file document.
java.lang.Exception - On errers.
public void exportXml(java.io.OutputStream xmlOutputStream)
throws java.lang.Exception
xmlOutputStream - the name of the output XML stream.
java.lang.Exception - On errors.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||