aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/pdfbox/pdmodel/fdf
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2008-11-25 12:03:13 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2008-11-25 12:03:13 +0000
commitc68ad0ec056b37c82debebcecfcde1866d61b4d9 (patch)
tree9e3ec28a87a5c29d1087fd03cc4c77899e2c758c /src/main/java/org/pdfbox/pdmodel/fdf
parent2eae233bf806c076acb8afea41eb16552687bcea (diff)
downloadpdf-as-3-c68ad0ec056b37c82debebcecfcde1866d61b4d9.tar.gz
pdf-as-3-c68ad0ec056b37c82debebcecfcde1866d61b4d9.tar.bz2
pdf-as-3-c68ad0ec056b37c82debebcecfcde1866d61b4d9.zip
Removing pdfbox from source.
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@301 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/org/pdfbox/pdmodel/fdf')
-rw-r--r--src/main/java/org/pdfbox/pdmodel/fdf/FDFAnnotation.java114
-rw-r--r--src/main/java/org/pdfbox/pdmodel/fdf/FDFCatalog.java195
-rw-r--r--src/main/java/org/pdfbox/pdmodel/fdf/FDFDictionary.java465
-rw-r--r--src/main/java/org/pdfbox/pdmodel/fdf/FDFDocument.java377
-rw-r--r--src/main/java/org/pdfbox/pdmodel/fdf/FDFField.java763
-rw-r--r--src/main/java/org/pdfbox/pdmodel/fdf/FDFIconFit.java227
-rw-r--r--src/main/java/org/pdfbox/pdmodel/fdf/FDFJavaScript.java172
-rw-r--r--src/main/java/org/pdfbox/pdmodel/fdf/FDFNamedPageReference.java128
-rw-r--r--src/main/java/org/pdfbox/pdmodel/fdf/FDFOptionElement.java129
-rw-r--r--src/main/java/org/pdfbox/pdmodel/fdf/FDFPage.java148
-rw-r--r--src/main/java/org/pdfbox/pdmodel/fdf/FDFPageInfo.java85
-rw-r--r--src/main/java/org/pdfbox/pdmodel/fdf/FDFTemplate.java167
-rw-r--r--src/main/java/org/pdfbox/pdmodel/fdf/package.html9
13 files changed, 0 insertions, 2979 deletions
diff --git a/src/main/java/org/pdfbox/pdmodel/fdf/FDFAnnotation.java b/src/main/java/org/pdfbox/pdmodel/fdf/FDFAnnotation.java
deleted file mode 100644
index 3d121e7..0000000
--- a/src/main/java/org/pdfbox/pdmodel/fdf/FDFAnnotation.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * Copyright (c) 2004, www.pdfbox.org
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of pdfbox; nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://www.pdfbox.org
- *
- */
-package org.pdfbox.pdmodel.fdf;
-
-import org.pdfbox.cos.COSBase;
-import org.pdfbox.cos.COSDictionary;
-import org.pdfbox.cos.COSInteger;
-import org.pdfbox.cos.COSNumber;
-
-import org.pdfbox.pdmodel.common.COSObjectable;
-
-/**
- * This represents an FDF annotation that is part of the FDF document.
- *
- * @author Ben Litchfield (ben@csh.rit.edu)
- * @version $Revision: 1.2 $
- */
-public class FDFAnnotation implements COSObjectable
-{
- private COSDictionary annot;
-
- /**
- * Default constructor.
- */
- public FDFAnnotation()
- {
- annot = new COSDictionary();
- }
-
- /**
- * Constructor.
- *
- * @param a The FDF annotation.
- */
- public FDFAnnotation( COSDictionary a )
- {
- annot = a;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSBase getCOSObject()
- {
- return annot;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSDictionary getCOSDictionary()
- {
- return annot;
- }
-
- /**
- * This will get the page number or null if it does not exist.
- *
- * @return The page number.
- */
- public Integer getPage()
- {
- Integer retval = null;
- COSNumber page = (COSNumber)annot.getDictionaryObject( "Page" );
- if( page != null )
- {
- retval = new Integer( page.intValue() );
- }
- return retval;
- }
-
- /**
- * This will set the page.
- *
- * @param page The page number.
- */
- public void setPage( int page )
- {
- annot.setItem( "Page", new COSInteger( page ) );
- }
-
-} \ No newline at end of file
diff --git a/src/main/java/org/pdfbox/pdmodel/fdf/FDFCatalog.java b/src/main/java/org/pdfbox/pdmodel/fdf/FDFCatalog.java
deleted file mode 100644
index f6959ee..0000000
--- a/src/main/java/org/pdfbox/pdmodel/fdf/FDFCatalog.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/**
- * Copyright (c) 2004, www.pdfbox.org
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of pdfbox; nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://www.pdfbox.org
- *
- */
-package org.pdfbox.pdmodel.fdf;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import org.pdfbox.cos.COSBase;
-import org.pdfbox.cos.COSDictionary;
-
-import org.pdfbox.pdmodel.common.COSObjectable;
-
-import org.pdfbox.pdmodel.interactive.digitalsignature.PDSignature;
-
-import org.w3c.dom.Element;
-
-/**
- * This represents an FDF catalog that is part of the FDF document.
- *
- * @author Ben Litchfield (ben@csh.rit.edu)
- * @version $Revision: 1.2 $
- */
-public class FDFCatalog implements COSObjectable
-{
- private COSDictionary catalog;
-
- /**
- * Default constructor.
- */
- public FDFCatalog()
- {
- catalog = new COSDictionary();
- }
-
- /**
- * Constructor.
- *
- * @param cat The FDF documents catalog.
- */
- public FDFCatalog( COSDictionary cat )
- {
- catalog = cat;
- }
-
- /**
- * This will create an FDF catalog from an XFDF XML document.
- *
- * @param element The XML document that contains the XFDF data.
- * @throws IOException If there is an error reading from the dom.
- */
- public FDFCatalog( Element element ) throws IOException
- {
- this();
- FDFDictionary fdfDict = new FDFDictionary( element );
- setFDF( fdfDict );
- }
-
- /**
- * This will write this element as an XML document.
- *
- * @param output The stream to write the xml to.
- *
- * @throws IOException If there is an error writing the XML.
- */
- public void writeXML( Writer output ) throws IOException
- {
- FDFDictionary fdf = getFDF();
- fdf.writeXML( output );
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSBase getCOSObject()
- {
- return catalog;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSDictionary getCOSDictionary()
- {
- return catalog;
- }
-
- /**
- * This will get the version that was specified in the catalog dictionary.
- *
- * @return The FDF version.
- */
- public String getVersion()
- {
- return catalog.getNameAsString( "Version" );
- }
-
- /**
- * This will set the version of the FDF document.
- *
- * @param version The new version for the FDF document.
- */
- public void setVersion( String version )
- {
- catalog.setName( "Version", version );
- }
-
- /**
- * This will get the FDF dictionary.
- *
- * @return The FDF dictionary.
- */
- public FDFDictionary getFDF()
- {
- COSDictionary fdf = (COSDictionary)catalog.getDictionaryObject( "FDF" );
- FDFDictionary retval = null;
- if( fdf != null )
- {
- retval = new FDFDictionary( fdf );
- }
- else
- {
- retval = new FDFDictionary();
- setFDF( retval );
- }
- return retval;
- }
-
- /**
- * This will set the FDF document.
- *
- * @param fdf The new FDF dictionary.
- */
- public void setFDF( FDFDictionary fdf )
- {
- catalog.setItem( "FDF", fdf );
- }
-
- /**
- * This will get the signature or null if there is none.
- *
- * @return The signature.
- */
- public PDSignature getSignature()
- {
- PDSignature signature = null;
- COSDictionary sig = (COSDictionary)catalog.getDictionaryObject( "Sig" );
- if( sig != null )
- {
- signature = new PDSignature( sig );
- }
- return signature;
- }
-
- /**
- * This will set the signature that is associated with this catalog.
- *
- * @param sig The new signature.
- */
- public void setSignature( PDSignature sig )
- {
- catalog.setItem( "Sig", sig );
- }
-} \ No newline at end of file
diff --git a/src/main/java/org/pdfbox/pdmodel/fdf/FDFDictionary.java b/src/main/java/org/pdfbox/pdmodel/fdf/FDFDictionary.java
deleted file mode 100644
index ab25bc7..0000000
--- a/src/main/java/org/pdfbox/pdmodel/fdf/FDFDictionary.java
+++ /dev/null
@@ -1,465 +0,0 @@
-/**
- * Copyright (c) 2004, www.pdfbox.org
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of pdfbox; nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://www.pdfbox.org
- *
- */
-package org.pdfbox.pdmodel.fdf;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.pdfbox.cos.COSArray;
-import org.pdfbox.cos.COSBase;
-import org.pdfbox.cos.COSDictionary;
-import org.pdfbox.cos.COSStream;
-import org.pdfbox.cos.COSString;
-
-import org.pdfbox.pdmodel.common.COSObjectable;
-import org.pdfbox.pdmodel.common.COSArrayList;
-import org.pdfbox.pdmodel.common.filespecification.PDFileSpecification;
-import org.pdfbox.pdmodel.common.filespecification.PDSimpleFileSpecification;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * This represents an FDF dictionary that is part of the FDF document.
- *
- * @author Ben Litchfield (ben@csh.rit.edu)
- * @version $Revision: 1.6 $
- */
-public class FDFDictionary implements COSObjectable
-{
- private COSDictionary fdf;
-
- /**
- * Default constructor.
- */
- public FDFDictionary()
- {
- fdf = new COSDictionary();
- }
-
- /**
- * Constructor.
- *
- * @param fdfDictionary The FDF documents catalog.
- */
- public FDFDictionary( COSDictionary fdfDictionary )
- {
- fdf = fdfDictionary;
- }
-
- /**
- * This will create an FDF dictionary from an XFDF XML document.
- *
- * @param fdfXML The XML document that contains the XFDF data.
- * @throws IOException If there is an error reading from the dom.
- */
- public FDFDictionary( Element fdfXML ) throws IOException
- {
- this();
- NodeList nodeList = fdfXML.getChildNodes();
- for( int i=0; i<nodeList.getLength(); i++ )
- {
- Node node = nodeList.item( i );
- if( node instanceof Element )
- {
- Element child = (Element)node;
- if( child.getTagName().equals( "f" ) )
- {
- PDSimpleFileSpecification fs = new PDSimpleFileSpecification();
- fs.setFile( child.getAttribute( "href" ) );
-
- }
- else if( child.getTagName().equals( "ids" ) )
- {
- COSArray ids = new COSArray();
- String original = child.getAttribute( "original" );
- String modified = child.getAttribute( "modified" );
- ids.add( COSString.createFromHexString( original ) );
- ids.add( COSString.createFromHexString( modified ) );
- setID( ids );
- }
- else if( child.getTagName().equals( "fields" ) )
- {
- NodeList fields = child.getElementsByTagName( "field" );
- List fieldList = new ArrayList();
- for( int f=0; f<fields.getLength(); f++ )
- {
- fieldList.add( new FDFField( (Element)fields.item( f ) ) );
- }
- setFields( fieldList );
- }
- }
- }
- }
-
- /**
- * This will write this element as an XML document.
- *
- * @param output The stream to write the xml to.
- *
- * @throws IOException If there is an error writing the XML.
- */
- public void writeXML( Writer output ) throws IOException
- {
- PDFileSpecification fs = this.getFile();
- if( fs != null )
- {
- output.write( "<f href=\"" + fs.getFile() + "\" />\n" );
- }
- COSArray ids = this.getID();
- if( ids != null )
- {
- COSString original = (COSString)ids.getObject( 0 );
- COSString modified = (COSString)ids.getObject( 1 );
- output.write( "<ids original=\"" + original.getHexString() + "\" " );
- output.write( "modified=\"" + modified.getHexString() + "\" />\n");
- }
- List fields = getFields();
- if( fields != null && fields.size() > 0 )
- {
- output.write( "<fields>\n" );
- for( int i=0; i<fields.size(); i++ )
- {
- ((FDFField)fields.get( i )).writeXML( output );
- }
- output.write( "</fields>\n" );
- }
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSBase getCOSObject()
- {
- return fdf;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSDictionary getCOSDictionary()
- {
- return fdf;
- }
-
- /**
- * The source file or target file: the PDF document file that
- * this FDF file was exported from or is intended to be imported into.
- *
- * @return The F entry of the FDF dictionary.
- */
- public PDFileSpecification getFile()
- {
- return PDFileSpecification.createFS( fdf.getDictionaryObject( "F" ) );
- }
-
- /**
- * This will set the file specification.
- *
- * @param fs The file specification.
- */
- public void setFile( PDFileSpecification fs )
- {
- fdf.setItem( "F", fs );
- }
-
- /**
- * This is the FDF id.
- *
- * @return The FDF ID.
- */
- public COSArray getID()
- {
- return (COSArray)fdf.getDictionaryObject( "ID" );
- }
-
- /**
- * This will set the FDF id.
- *
- * @param id The new id for the FDF.
- */
- public void setID( COSArray id )
- {
- fdf.setItem( "ID", id );
- }
-
- /**
- * This will get the list of FDF Fields. This will return a list of FDFField
- * objects.
- *
- * @return A list of FDF fields.
- */
- public List getFields()
- {
- List retval = null;
- COSArray fieldArray = (COSArray)fdf.getDictionaryObject( "Fields" );
- if( fieldArray != null )
- {
- List fields = new ArrayList();
- for( int i=0; i<fieldArray.size(); i++ )
- {
- fields.add( new FDFField( (COSDictionary)fieldArray.getObject( i ) ) );
- }
- retval = new COSArrayList( fields, fieldArray );
- }
- return retval;
- }
-
- /**
- * This will set the list of fields. This should be a list of FDFField objects.
- *
- * @param fields The list of fields.
- */
- public void setFields( List fields )
- {
- fdf.setItem( "Fields", COSArrayList.converterToCOSArray( fields ) );
- }
-
- /**
- * This will get the status string to be displayed as the result of an
- * action.
- *
- * @return The status.
- */
- public String getStatus()
- {
- return fdf.getString( "Status" );
- }
-
- /**
- * This will set the status string.
- *
- * @param status The new status string.
- */
- public void setStatus( String status )
- {
- fdf.setString( "Status", status );
- }
-
- /**
- * This will get the list of FDF Pages. This will return a list of FDFPage objects.
- *
- * @return A list of FDF pages.
- */
- public List getPages()
- {
- List retval = null;
- COSArray pageArray = (COSArray)fdf.getDictionaryObject( "Pages" );
- if( pageArray != null )
- {
- List pages = new ArrayList();
- for( int i=0; i<pageArray.size(); i++ )
- {
- pages.add( new FDFPage( (COSDictionary)pageArray.get( i ) ) );
- }
- retval = new COSArrayList( pages, pageArray );
- }
- return retval;
- }
-
- /**
- * This will set the list of pages. This should be a list of FDFPage objects.
- *
- *
- * @param pages The list of pages.
- */
- public void setPages( List pages )
- {
- fdf.setItem( "Pages", COSArrayList.converterToCOSArray( pages ) );
- }
-
- /**
- * The encoding to be used for a FDF field. The default is PDFDocEncoding
- * and this method will never return null.
- *
- * @return The encoding value.
- */
- public String getEncoding()
- {
- String encoding = fdf.getNameAsString( "Encoding" );
- if( encoding == null )
- {
- encoding = "PDFDocEncoding";
- }
- return encoding;
-
- }
-
- /**
- * This will set the encoding.
- *
- * @param encoding The new encoding.
- */
- public void setEncoding( String encoding )
- {
- fdf.setName( "Encoding", encoding );
- }
-
- /**
- * This will get the list of FDF Annotations. This will return a list of FDFAnnotation objects
- * or null if the entry is not set.
- *
- * @return A list of FDF annotations.
- */
- public List getAnnotations()
- {
- List retval = null;
- COSArray annotArray = (COSArray)fdf.getDictionaryObject( "Annots" );
- if( annotArray != null )
- {
- List annots = new ArrayList();
- for( int i=0; i<annotArray.size(); i++ )
- {
- annots.add( new FDFAnnotation( (COSDictionary)annotArray.getObject( i ) ) );
- }
- retval = new COSArrayList( annots, annotArray );
- }
- return retval;
- }
-
- /**
- * This will set the list of annotations. This should be a list of FDFAnnotation objects.
- *
- *
- * @param annots The list of annotations.
- */
- public void setAnnotations( List annots )
- {
- fdf.setItem( "Annots", COSArrayList.converterToCOSArray( annots ) );
- }
-
- /**
- * This will get the incremental updates since the PDF was last opened.
- *
- * @return The differences entry of the FDF dictionary.
- */
- public COSStream getDifferences()
- {
- return (COSStream)fdf.getDictionaryObject( "Differences" );
- }
-
- /**
- * This will set the differences stream.
- *
- * @param diff The new differences stream.
- */
- public void setDifferences( COSStream diff )
- {
- fdf.setItem( "Differences", diff );
- }
-
- /**
- * This will get the target frame in the browser to open this document.
- *
- * @return The target frame.
- */
- public String getTarget()
- {
- return fdf.getString( "Target" );
- }
-
- /**
- * This will set the target frame in the browser to open this document.
- *
- * @param target The new target frame.
- */
- public void setTarget( String target )
- {
- fdf.setString( "Target", target );
- }
-
- /**
- * This will get the list of embedded FDF entries, or null if the entry is null.
- * This will return a list of PDFileSpecification objects.
- *
- * @return A list of embedded FDF files.
- */
- public List getEmbeddedFDFs()
- {
- List retval = null;
- COSArray embeddedArray = (COSArray)fdf.getDictionaryObject( "EmbeddedFDFs" );
- if( embeddedArray != null )
- {
- List embedded = new ArrayList();
- for( int i=0; i<embeddedArray.size(); i++ )
- {
- embedded.add( PDFileSpecification.createFS( embeddedArray.get( i ) ) );
- }
- retval = new COSArrayList( embedded, embeddedArray );
- }
- return retval;
- }
-
- /**
- * This will set the list of embedded FDFs. This should be a list of
- * PDFileSpecification objects.
- *
- *
- * @param embedded The list of embedded FDFs.
- */
- public void setEmbeddedFDFs( List embedded )
- {
- fdf.setItem( "EmbeddedFDFs", COSArrayList.converterToCOSArray( embedded ) );
- }
-
- /**
- * This will get the java script entry.
- *
- * @return The java script entry describing javascript commands.
- */
- public FDFJavaScript getJavaScript()
- {
- FDFJavaScript fs = null;
- COSDictionary dic = (COSDictionary)fdf.getDictionaryObject( "JavaScript" );
- if( dic != null )
- {
- fs = new FDFJavaScript( dic );
- }
- return fs;
- }
-
- /**
- * This will set the JavaScript entry.
- *
- * @param js The javascript entries.
- */
- public void setJavaScript( FDFJavaScript js )
- {
- fdf.setItem( "JavaScript", js );
- }
-
-} \ No newline at end of file
diff --git a/src/main/java/org/pdfbox/pdmodel/fdf/FDFDocument.java b/src/main/java/org/pdfbox/pdmodel/fdf/FDFDocument.java
deleted file mode 100644
index 8350314..0000000
--- a/src/main/java/org/pdfbox/pdmodel/fdf/FDFDocument.java
+++ /dev/null
@@ -1,377 +0,0 @@
-/**
- * Copyright (c) 2004-2005, www.pdfbox.org
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of pdfbox; nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://www.pdfbox.org
- *
- */
-package org.pdfbox.pdmodel.fdf;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Writer;
-
-import org.pdfbox.cos.COSDictionary;
-import org.pdfbox.cos.COSDocument;
-import org.pdfbox.cos.COSName;
-
-import org.pdfbox.exceptions.COSVisitorException;
-
-import org.pdfbox.pdfparser.PDFParser;
-
-import org.pdfbox.pdfwriter.COSWriter;
-
-import org.pdfbox.util.XMLUtil;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * This is the in-memory representation of the FDF document. You need to call
- * close() on this object when you are done using it!!
- *
- * @author Ben Litchfield (ben@benlitchfield.com)
- * @version $Revision: 1.5 $
- */
-public class FDFDocument
-{
- private COSDocument document;
-
- /**
- * Constructor, creates a new FDF document.
- *
- * @throws IOException If there is an error creating this document.
- */
- public FDFDocument() throws IOException
- {
- document = new COSDocument();
- document.setHeaderString( "%FDF-1.2" );
-
- //First we need a trailer
- document.setTrailer( new COSDictionary() );
-
- //Next we need the root dictionary.
- FDFCatalog catalog = new FDFCatalog();
- setCatalog( catalog );
- }
-
- /**
- * Constructor that uses an existing document. The COSDocument that
- * is passed in must be valid.
- *
- * @param doc The COSDocument that this document wraps.
- */
- public FDFDocument( COSDocument doc )
- {
- document = doc;
- }
-
- /**
- * This will create an FDF document from an XFDF XML document.
- *
- * @param doc The XML document that contains the XFDF data.
- * @throws IOException If there is an error reading from the dom.
- */
- public FDFDocument( Document doc ) throws IOException
- {
- this();
- Element xfdf = doc.getDocumentElement();
- if( !xfdf.getNodeName().equals( "xfdf" ) )
- {
- throw new IOException( "Error while importing xfdf document, " +
- "root should be 'xfdf' and not '" + xfdf.getNodeName() + "'" );
- }
- FDFCatalog cat = new FDFCatalog( xfdf );
- setCatalog( cat );
- }
-
- /**
- * This will write this element as an XML document.
- *
- * @param output The stream to write the xml to.
- *
- * @throws IOException If there is an error writing the XML.
- */
- public void writeXML( Writer output ) throws IOException
- {
- output.write( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" );
- output.write( "<xfdf xmlns=\"http://ns.adobe.com/xfdf/\" xml:space=\"preserve\">\n" );
-
- getCatalog().writeXML( output );
-
- output.write( "</xfdf>\n" );
- }
-
-
-
- /**
- * This will get the low level document.
- *
- * @return The document that this layer sits on top of.
- */
- public COSDocument getDocument()
- {
- return document;
- }
-
- /**
- * This will get the FDF Catalog. This is guaranteed to not return null.
- *
- * @return The documents /Root dictionary
- */
- public FDFCatalog getCatalog()
- {
- FDFCatalog retval = null;
- COSDictionary trailer = document.getTrailer();
- COSDictionary root = (COSDictionary)trailer.getDictionaryObject( COSName.ROOT );
- if( root == null )
- {
- retval = new FDFCatalog();
- setCatalog( retval );
- }
- else
- {
- retval = new FDFCatalog( root );
- }
- return retval;
- }
-
- /**
- * This will set the FDF catalog for this FDF document.
- *
- * @param cat The FDF catalog.
- */
- public void setCatalog( FDFCatalog cat )
- {
- COSDictionary trailer = document.getTrailer();
- trailer.setItem( COSName.ROOT, cat );
- }
-
- /**
- * This will load a document from a file.
- *
- * @param filename The name of the file to load.
- *
- * @return The document that was loaded.
- *
- * @throws IOException If there is an error reading from the stream.
- */
- public static FDFDocument load( String filename ) throws IOException
- {
- return load( new BufferedInputStream( new FileInputStream( filename ) ) );
- }
-
- /**
- * This will load a document from a file.
- *
- * @param file The name of the file to load.
- *
- * @return The document that was loaded.
- *
- * @throws IOException If there is an error reading from the stream.
- */
- public static FDFDocument load( File file ) throws IOException
- {
- return load( new BufferedInputStream( new FileInputStream( file ) ) );
- }
-
- /**
- * This will load a document from an input stream.
- *
- * @param input The stream that contains the document.
- *
- * @return The document that was loaded.
- *
- * @throws IOException If there is an error reading from the stream.
- */
- public static FDFDocument load( InputStream input ) throws IOException
- {
- PDFParser parser = new PDFParser( input );
- parser.parse();
- return parser.getFDFDocument();
- }
-
- /**
- * This will load a document from a file.
- *
- * @param filename The name of the file to load.
- *
- * @return The document that was loaded.
- *
- * @throws IOException If there is an error reading from the stream.
- */
- public static FDFDocument loadXFDF( String filename ) throws IOException
- {
- return loadXFDF( new BufferedInputStream( new FileInputStream( filename ) ) );
- }
-
- /**
- * This will load a document from a file.
- *
- * @param file The name of the file to load.
- *
- * @return The document that was loaded.
- *
- * @throws IOException If there is an error reading from the stream.
- */
- public static FDFDocument loadXFDF( File file ) throws IOException
- {
- return loadXFDF( new BufferedInputStream( new FileInputStream( file ) ) );
- }
-
- /**
- * This will load a document from an input stream.
- *
- * @param input The stream that contains the document.
- *
- * @return The document that was loaded.
- *
- * @throws IOException If there is an error reading from the stream.
- */
- public static FDFDocument loadXFDF( InputStream input ) throws IOException
- {
- Document doc = XMLUtil.parse( input );
- return new FDFDocument( doc );
- }
-
- /**
- * This will save this document to the filesystem.
- *
- * @param fileName The file to save as.
- *
- * @throws IOException If there is an error saving the document.
- * @throws COSVisitorException If an error occurs while generating the data.
- */
- public void save( File fileName ) throws IOException, COSVisitorException
- {
- save( new FileOutputStream( fileName ) );
- }
-
- /**
- * This will save this document to the filesystem.
- *
- * @param fileName The file to save as.
- *
- * @throws IOException If there is an error saving the document.
- * @throws COSVisitorException If an error occurs while generating the data.
- */
- public void save( String fileName ) throws IOException, COSVisitorException
- {
- save( new FileOutputStream( fileName ) );
- }
-
- /**
- * This will save the document to an output stream.
- *
- * @param output The stream to write to.
- *
- * @throws IOException If there is an error writing the document.
- * @throws COSVisitorException If an error occurs while generating the data.
- */
- public void save( OutputStream output ) throws IOException, COSVisitorException
- {
- COSWriter writer = null;
- try
- {
- writer = new COSWriter( output );
- writer.write( document );
- writer.close();
- }
- finally
- {
- if( writer != null )
- {
- writer.close();
- }
- }
- }
-
- /**
- * This will save this document to the filesystem.
- *
- * @param fileName The file to save as.
- *
- * @throws IOException If there is an error saving the document.
- * @throws COSVisitorException If an error occurs while generating the data.
- */
- public void saveXFDF( File fileName ) throws IOException, COSVisitorException
- {
- saveXFDF( new BufferedWriter( new FileWriter( fileName ) ) );
- }
-
- /**
- * This will save this document to the filesystem.
- *
- * @param fileName The file to save as.
- *
- * @throws IOException If there is an error saving the document.
- * @throws COSVisitorException If an error occurs while generating the data.
- */
- public void saveXFDF( String fileName ) throws IOException, COSVisitorException
- {
- saveXFDF( new BufferedWriter( new FileWriter( fileName ) ) );
- }
-
- /**
- * This will save the document to an output stream and close the stream.
- *
- * @param output The stream to write to.
- *
- * @throws IOException If there is an error writing the document.
- * @throws COSVisitorException If an error occurs while generating the data.
- */
- public void saveXFDF( Writer output ) throws IOException, COSVisitorException
- {
- try
- {
- writeXML( output );
- }
- finally
- {
- if( output != null )
- {
- output.close();
- }
- }
- }
-
- /**
- * This will close the underlying COSDocument object.
- *
- * @throws IOException If there is an error releasing resources.
- */
- public void close() throws IOException
- {
- document.close();
- }
-} \ No newline at end of file
diff --git a/src/main/java/org/pdfbox/pdmodel/fdf/FDFField.java b/src/main/java/org/pdfbox/pdmodel/fdf/FDFField.java
deleted file mode 100644
index 35b90ed..0000000
--- a/src/main/java/org/pdfbox/pdmodel/fdf/FDFField.java
+++ /dev/null
@@ -1,763 +0,0 @@
-/**
- * Copyright (c) 2004, www.pdfbox.org
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of pdfbox; nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://www.pdfbox.org
- *
- */
-package org.pdfbox.pdmodel.fdf;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.pdfbox.cos.COSArray;
-import org.pdfbox.cos.COSBase;
-import org.pdfbox.cos.COSDictionary;
-import org.pdfbox.cos.COSInteger;
-import org.pdfbox.cos.COSName;
-import org.pdfbox.cos.COSNumber;
-import org.pdfbox.cos.COSStream;
-import org.pdfbox.cos.COSString;
-
-import org.pdfbox.pdmodel.common.COSObjectable;
-import org.pdfbox.pdmodel.common.COSArrayList;
-import org.pdfbox.pdmodel.common.PDTextStream;
-
-import org.pdfbox.pdmodel.interactive.action.PDActionFactory;
-import org.pdfbox.pdmodel.interactive.action.PDAdditionalActions;
-import org.pdfbox.pdmodel.interactive.action.type.PDAction;
-
-import org.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary;
-
-import org.pdfbox.util.XMLUtil;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * This represents an FDF field that is part of the FDF document.
- *
- * @author Ben Litchfield (ben@csh.rit.edu)
- * @version $Revision: 1.4 $
- */
-public class FDFField implements COSObjectable
-{
- private COSDictionary field;
-
- /**
- * Default constructor.
- */
- public FDFField()
- {
- field = new COSDictionary();
- }
-
- /**
- * Constructor.
- *
- * @param f The FDF field.
- */
- public FDFField( COSDictionary f )
- {
- field = f;
- }
-
- /**
- * This will create an FDF field from an XFDF XML document.
- *
- * @param fieldXML The XML document that contains the XFDF data.
- * @throws IOException If there is an error reading from the dom.
- */
- public FDFField( Element fieldXML ) throws IOException
- {
- this();
- this.setPartialFieldName( fieldXML.getAttribute( "name" ) );
- NodeList nodeList = fieldXML.getChildNodes();
- List kids = new ArrayList();
- for( int i=0; i<nodeList.getLength(); i++ )
- {
- Node node = nodeList.item( i );
- if( node instanceof Element )
- {
- Element child = (Element)node;
- if( child.getTagName().equals( "value" ) )
- {
- setValue( XMLUtil.getNodeValue( child ) );
- }
- else if( child.getTagName().equals( "value-richtext" ) )
- {
- setRichText( new PDTextStream( XMLUtil.getNodeValue( child ) ) );
- }
- else if( child.getTagName().equals( "field" ) )
- {
- kids.add( new FDFField( child ) );
- }
- }
- }
- if( kids.size() > 0 )
- {
- setKids( kids );
- }
-
- }
-
- /**
- * This will write this element as an XML document.
- *
- * @param output The stream to write the xml to.
- *
- * @throws IOException If there is an error writing the XML.
- */
- public void writeXML( Writer output ) throws IOException
- {
- output.write( "<field name=\"" + getPartialFieldName() + "\">\n");
- Object value = getValue();
- if( value != null )
- {
- output.write( "<value>" + value + "</value>\n" );
- }
- PDTextStream rt = getRichText();
- if( rt != null )
- {
- output.write( "<value-richtext>" + rt.getAsString() + "</value-richtext>\n" );
- }
- List kids = getKids();
- if( kids != null )
- {
- for( int i=0; i<kids.size(); i++ )
- {
- ((FDFField)kids.get( i ) ).writeXML( output );
- }
- }
- output.write( "</field>\n");
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSBase getCOSObject()
- {
- return field;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSDictionary getCOSDictionary()
- {
- return field;
- }
-
- /**
- * This will get the list of kids. This will return a list of FDFField objects.
- * This will return null if the underlying list is null.
- *
- * @return The list of kids.
- */
- public List getKids()
- {
- COSArray kids = (COSArray)field.getDictionaryObject( "Kids" );
- List retval = null;
- if( kids != null )
- {
- List actuals = new ArrayList();
- for( int i=0; i<kids.size(); i++ )
- {
- actuals.add( new FDFField( (COSDictionary)kids.getObject( i ) ) );
- }
- retval = new COSArrayList( actuals, kids );
- }
- return retval;
- }
-
- /**
- * This will set the list of kids.
- *
- * @param kids A list of FDFField objects.
- */
- public void setKids( List kids )
- {
- field.setItem( "Kids", COSArrayList.converterToCOSArray( kids ) );
- }
-
- /**
- * This will get the "T" entry in the field dictionary. A partial field
- * name. Where the fully qualified field name is a concatenation of
- * the parent's fully qualified field name and "." as a separator. For example<br/>
- * Address.State<br />
- * Address.City<br />
- *
- * @return The partial field name.
- */
- public String getPartialFieldName()
- {
- return field.getString( "T" );
- }
-
- /**
- * This will set the partial field name.
- *
- * @param partial The partial field name.
- */
- public void setPartialFieldName( String partial )
- {
- field.setString( "T", partial );
- }
-
- /**
- * This will set the value for the field. This will return type will either be <br />
- * String : Checkboxes, Radio Button <br />
- * java.util.List of strings: Choice Field
- * PDTextStream: Textfields
- *
- * @return The value of the field.
- *
- * @throws IOException If there is an error getting the value.
- */
- public Object getValue() throws IOException
- {
- Object retval = null;
- COSBase value = field.getDictionaryObject( "V" );
- if( value instanceof COSName )
- {
- retval = ((COSName)value).getName();
- }
- else if( value instanceof COSArray )
- {
- retval = COSArrayList.convertCOSStringCOSArrayToList( (COSArray)value );
- }
- else if( value instanceof COSString || value instanceof COSStream )
- {
- retval = PDTextStream.createTextStream( value );
- }
- else if( value == null )
- {
- //Ok, value is null so do nothing
- }
- else
- {
- throw new IOException( "Error:Unknown type for field import" + value );
- }
- return retval;
- }
-
- /**
- * You should pass in a string, or a java.util.List of strings to set the
- * value.
- *
- * @param value The value that should populate when imported.
- *
- * @throws IOException If there is an error setting the value.
- */
- public void setValue( Object value ) throws IOException
- {
- COSBase cos = null;
- if( value instanceof List )
- {
- cos = COSArrayList.convertStringListToCOSStringCOSArray( (List)value );
- }
- else if( value instanceof String )
- {
- cos = COSName.getPDFName( (String)value );
- }
- else if( value instanceof COSObjectable )
- {
- cos = ((COSObjectable)value).getCOSObject();
- }
- else if( value == null )
- {
- //do nothing and let cos remain null as well.
- }
- else
- {
- throw new IOException( "Error:Unknown type for field import" + value );
- }
- field.setItem( "V", cos );
- }
-
- /**
- * This will get the Ff entry of the cos dictionary. If it it not present then
- * this method will return null.
- *
- * @return The field flags.
- */
- public Integer getFieldFlags()
- {
- Integer retval = null;
- COSNumber ff = (COSNumber)field.getDictionaryObject( "Ff" );
- if( ff != null )
- {
- retval = new Integer( ff.intValue() );
- }
- return retval;
- }
-
- /**
- * This will get the field flags that are associated with this field. The Ff entry
- * in the FDF field dictionary.
- *
- * @param ff The new value for the field flags.
- */
- public void setFieldFlags( Integer ff )
- {
- COSInteger value = null;
- if( ff != null )
- {
- value = new COSInteger( ff.intValue() );
- }
- field.setItem( "Ff", value );
- }
-
- /**
- * This will get the field flags that are associated with this field. The Ff entry
- * in the FDF field dictionary.
- *
- * @param ff The new value for the field flags.
- */
- public void setFieldFlags( int ff )
- {
- field.setItem( "Ff", new COSInteger( ff ) );
- }
-
- /**
- * This will get the SetFf entry of the cos dictionary. If it it not present then
- * this method will return null.
- *
- * @return The field flags.
- */
- public Integer getSetFieldFlags()
- {
- Integer retval = null;
- COSNumber ff = (COSNumber)field.getDictionaryObject( "SetFf" );
- if( ff != null )
- {
- retval = new Integer( ff.intValue() );
- }
- return retval;
- }
-
- /**
- * This will get the field flags that are associated with this field. The SetFf entry
- * in the FDF field dictionary.
- *
- * @param ff The new value for the "set field flags".
- */
- public void setSetFieldFlags( Integer ff )
- {
- COSInteger value = null;
- if( ff != null )
- {
- value = new COSInteger( ff.intValue() );
- }
- field.setItem( "SetFf", value );
- }
-
- /**
- * This will get the field flags that are associated with this field. The SetFf entry
- * in the FDF field dictionary.
- *
- * @param ff The new value for the "set field flags".
- */
- public void setSetFieldFlags( int ff )
- {
- field.setItem( "SetFf", new COSInteger( ff ) );
- }
-
- /**
- * This will get the ClrFf entry of the cos dictionary. If it it not present then
- * this method will return null.
- *
- * @return The field flags.
- */
- public Integer getClearFieldFlags()
- {
- Integer retval = null;
- COSNumber ff = (COSNumber)field.getDictionaryObject( "ClrFf" );
- if( ff != null )
- {
- retval = new Integer( ff.intValue() );
- }
- return retval;
- }
-
- /**
- * This will get the field flags that are associated with this field. The ClrFf entry
- * in the FDF field dictionary.
- *
- * @param ff The new value for the "clear field flags".
- */
- public void setClearFieldFlags( Integer ff )
- {
- COSInteger value = null;
- if( ff != null )
- {
- value = new COSInteger( ff.intValue() );
- }
- field.setItem( "ClrFf", value );
- }
-
- /**
- * This will get the field flags that are associated with this field. The ClrFf entry
- * in the FDF field dictionary.
- *
- * @param ff The new value for the "clear field flags".
- */
- public void setClearFieldFlags( int ff )
- {
- field.setItem( "ClrFf", new COSInteger( ff ) );
- }
-
- /**
- * This will get the F entry of the cos dictionary. If it it not present then
- * this method will return null.
- *
- * @return The widget field flags.
- */
- public Integer getWidgetFieldFlags()
- {
- Integer retval = null;
- COSNumber f = (COSNumber)field.getDictionaryObject( "F" );
- if( f != null )
- {
- retval = new Integer( f.intValue() );
- }
- return retval;
- }
-
- /**
- * This will get the widget field flags that are associated with this field. The F entry
- * in the FDF field dictionary.
- *
- * @param f The new value for the field flags.
- */
- public void setWidgetFieldFlags( Integer f )
- {
- COSInteger value = null;
- if( f != null )
- {
- value = new COSInteger( f.intValue() );
- }
- field.setItem( "F", value );
- }
-
- /**
- * This will get the field flags that are associated with this field. The F entry
- * in the FDF field dictionary.
- *
- * @param f The new value for the field flags.
- */
- public void setWidgetFieldFlags( int f )
- {
- field.setItem( "F", new COSInteger( f ) );
- }
-
- /**
- * This will get the SetF entry of the cos dictionary. If it it not present then
- * this method will return null.
- *
- * @return The field flags.
- */
- public Integer getSetWidgetFieldFlags()
- {
- Integer retval = null;
- COSNumber ff = (COSNumber)field.getDictionaryObject( "SetF" );
- if( ff != null )
- {
- retval = new Integer( ff.intValue() );
- }
- return retval;
- }
-
- /**
- * This will get the widget field flags that are associated with this field. The SetF entry
- * in the FDF field dictionary.
- *
- * @param ff The new value for the "set widget field flags".
- */
- public void setSetWidgetFieldFlags( Integer ff )
- {
- COSInteger value = null;
- if( ff != null )
- {
- value = new COSInteger( ff.intValue() );
- }
- field.setItem( "SetF", value );
- }
-
- /**
- * This will get the widget field flags that are associated with this field. The SetF entry
- * in the FDF field dictionary.
- *
- * @param ff The new value for the "set widget field flags".
- */
- public void setSetWidgetFieldFlags( int ff )
- {
- field.setItem( "SetF", new COSInteger( ff ) );
- }
-
- /**
- * This will get the ClrF entry of the cos dictionary. If it it not present then
- * this method will return null.
- *
- * @return The widget field flags.
- */
- public Integer getClearWidgetFieldFlags()
- {
- Integer retval = null;
- COSNumber ff = (COSNumber)field.getDictionaryObject( "ClrF" );
- if( ff != null )
- {
- retval = new Integer( ff.intValue() );
- }
- return retval;
- }
-
- /**
- * This will get the field flags that are associated with this field. The ClrF entry
- * in the FDF field dictionary.
- *
- * @param ff The new value for the "clear widget field flags".
- */
- public void setClearWidgetFieldFlags( Integer ff )
- {
- COSInteger value = null;
- if( ff != null )
- {
- value = new COSInteger( ff.intValue() );
- }
- field.setItem( "ClrF", value );
- }
-
- /**
- * This will get the field flags that are associated with this field. The ClrF entry
- * in the FDF field dictionary.
- *
- * @param ff The new value for the "clear field flags".
- */
- public void setClearWidgetFieldFlags( int ff )
- {
- field.setItem( "ClrF", new COSInteger( ff ) );
- }
-
- /**
- * This will get the appearance dictionary that specifies the appearance of
- * a pushbutton field.
- *
- * @return The AP entry of this dictionary.
- */
- public PDAppearanceDictionary getAppearanceDictionary()
- {
- PDAppearanceDictionary retval = null;
- COSDictionary dict = (COSDictionary)field.getDictionaryObject( "AP" );
- if( dict != null )
- {
- retval = new PDAppearanceDictionary( dict );
- }
- return retval;
- }
-
- /**
- * This will set the appearance dictionary.
- *
- * @param ap The apperance dictionary.
- */
- public void setAppearanceDictionary( PDAppearanceDictionary ap )
- {
- field.setItem( "AP", ap );
- }
-
- /**
- * This will get named page references..
- *
- * @return The named page references.
- */
- public FDFNamedPageReference getAppearanceStreamReference()
- {
- FDFNamedPageReference retval = null;
- COSDictionary ref = (COSDictionary)field.getDictionaryObject( "APRef" );
- if( ref != null )
- {
- retval = new FDFNamedPageReference( ref );
- }
- return retval;
- }
-
- /**
- * This will set the named page references.
- *
- * @param ref The named page references.
- */
- public void setAppearanceStreamReference( FDFNamedPageReference ref )
- {
- field.setItem( "APRef", ref );
- }
-
- /**
- * This will get the icon fit that is associated with this field.
- *
- * @return The IF entry.
- */
- public FDFIconFit getIconFit()
- {
- FDFIconFit retval = null;
- COSDictionary dic = (COSDictionary)field.getDictionaryObject( "IF" );
- if( dic != null )
- {
- retval = new FDFIconFit( dic );
- }
- return retval;
- }
-
- /**
- * This will set the icon fit entry.
- *
- * @param fit The icon fit object.
- */
- public void setIconFit( FDFIconFit fit )
- {
- field.setItem( "IF", fit );
- }
-
- /**
- * This will return a list of options for a choice field. The value in the
- * list will be 1 of 2 types. java.lang.String or FDFOptionElement.
- *
- * @return A list of all options.
- */
- public List getOptions()
- {
- List retval = null;
- COSArray array = (COSArray)field.getDictionaryObject( "Opt" );
- if( array != null )
- {
- List objects = new ArrayList();
- for( int i=0; i<array.size(); i++ )
- {
- COSBase next = array.getObject( i );
- if( next instanceof COSString )
- {
- objects.add( ((COSString)next).getString() );
- }
- else
- {
- COSArray value = (COSArray)next;
- objects.add( new FDFOptionElement( value ) );
- }
- }
- retval = new COSArrayList( objects, array );
- }
- return retval;
- }
-
- /**
- * This will set the options for the choice field. The objects in the list
- * should either be java.lang.String or FDFOptionElement.
- *
- * @param options The options to set.
- */
- public void setOptions( List options )
- {
- COSArray value = COSArrayList.converterToCOSArray( options );
- field.setItem( "Opt", value );
- }
-
- /**
- * This will get the action that is associated with this field.
- *
- * @return The A entry in the field dictionary.
- */
- public PDAction getAction()
- {
- return PDActionFactory.createAction( (COSDictionary)field.getDictionaryObject( "A" ) );
- }
-
- /**
- * This will set the action that is associated with this field.
- *
- * @param a The new action.
- */
- public void setAction( PDAction a )
- {
- field.setItem( "A", a );
- }
-
- /**
- * This will get a list of additional actions that will get executed based
- * on events.
- *
- * @return The AA entry in this field dictionary.
- */
- public PDAdditionalActions getAdditionalActions()
- {
- PDAdditionalActions retval = null;
- COSDictionary dict = (COSDictionary)field.getDictionaryObject( "AA" );
- if( dict != null )
- {
- retval = new PDAdditionalActions( dict );
- }
-
- return retval;
- }
-
- /**
- * This will set the additional actions that are associated with this field.
- *
- * @param aa The additional actions.
- */
- public void setAdditionalActions( PDAdditionalActions aa )
- {
- field.setItem( "AA", aa );
- }
-
- /**
- * This will set the rich text that is associated with this field.
- *
- * @return The rich text XHTML stream.
- */
- public PDTextStream getRichText()
- {
- COSBase rv = field.getDictionaryObject( "RV" );
- return PDTextStream.createTextStream( rv );
- }
-
- /**
- * This will set the rich text value.
- *
- * @param rv The rich text value for the stream.
- */
- public void setRichText( PDTextStream rv )
- {
- field.setItem( "RV", rv );
- }
-} \ No newline at end of file
diff --git a/src/main/java/org/pdfbox/pdmodel/fdf/FDFIconFit.java b/src/main/java/org/pdfbox/pdmodel/fdf/FDFIconFit.java
deleted file mode 100644
index c765bfc..0000000
--- a/src/main/java/org/pdfbox/pdmodel/fdf/FDFIconFit.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/**
- * Copyright (c) 2004-2005, www.pdfbox.org
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of pdfbox; nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://www.pdfbox.org
- *
- */
-package org.pdfbox.pdmodel.fdf;
-
-import org.pdfbox.cos.COSArray;
-import org.pdfbox.cos.COSBase;
-import org.pdfbox.cos.COSDictionary;
-
-import org.pdfbox.pdmodel.common.COSObjectable;
-import org.pdfbox.pdmodel.common.PDRange;
-
-/**
- * This represents an Icon fit dictionary for an FDF field.
- *
- * @author Ben Litchfield (ben@benlitchfield.com)
- * @version $Revision: 1.2 $
- */
-public class FDFIconFit implements COSObjectable
-{
- private COSDictionary fit;
-
- /**
- * A scale option.
- */
- public static final String SCALE_OPTION_ALWAYS = "A";
- /**
- * A scale option.
- */
- public static final String SCALE_OPTION_ONLY_WHEN_ICON_IS_BIGGER = "B";
- /**
- * A scale option.
- */
- public static final String SCALE_OPTION_ONLY_WHEN_ICON_IS_SMALLER = "S";
- /**
- * A scale option.
- */
- public static final String SCALE_OPTION_NEVER = "N";
-
- /**
- * Scale to fill with of annotation, disregarding aspect ratio.
- */
- public static final String SCALE_TYPE_ANAMORPHIC = "A";
- /**
- * Scale to fit width or height, smaller of two, while retaining aspect ration.
- */
- public static final String SCALE_TYPE_PROPORTIONAL = "P";
-
-
-
- /**
- * Default constructor.
- */
- public FDFIconFit()
- {
- fit = new COSDictionary();
- }
-
- /**
- * Constructor.
- *
- * @param f The icon fit dictionary.
- */
- public FDFIconFit( COSDictionary f )
- {
- fit = f;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSBase getCOSObject()
- {
- return fit;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSDictionary getCOSDictionary()
- {
- return fit;
- }
-
- /**
- * This will get the scale option. See the SCALE_OPTION_XXX constants. This
- * is guaranteed to never return null. Default: Always
- *
- * @return The scale option.
- */
- public String getScaleOption()
- {
- String retval = fit.getNameAsString( "SW" );
- if( retval == null )
- {
- retval = SCALE_OPTION_ALWAYS;
- }
- return retval;
- }
-
- /**
- * This will set the scale option for the icon. Set the SCALE_OPTION_XXX constants.
- *
- * @param option The scale option.
- */
- public void setScaleOption( String option )
- {
- fit.setName( "SW", option );
- }
-
- /**
- * This will get the scale type. See the SCALE_TYPE_XXX constants. This is
- * guaranteed to never return null. Default: Proportional
- *
- * @return The scale type.
- */
- public String getScaleType()
- {
- String retval = fit.getNameAsString( "S" );
- if( retval == null )
- {
- retval = SCALE_TYPE_PROPORTIONAL;
- }
- return retval;
- }
-
- /**
- * This will set the scale type. See the SCALE_TYPE_XXX constants.
- *
- * @param scale The scale type.
- */
- public void setScaleType( String scale )
- {
- fit.setName( "S", scale );
- }
-
- /**
- * This is guaranteed to never return null.<br />
- *
- * To quote the PDF Spec
- * "An array of two numbers between 0.0 and 1.0 indicating the fraction of leftover
- * space to allocate at the left and bottom of the icon. A value of [0.0 0.0] positions the
- * icon at the bottom-left corner of the annotation rectangle; a value of [0.5 0.5] centers it
- * within the rectangle. This entry is used only if the icon is scaled proportionally. Default
- * value: [0.5 0.5]."
- *
- * @return The fractional space to allocate.
- */
- public PDRange getFractionalSpaceToAllocate()
- {
- PDRange retval = null;
- COSArray array = (COSArray)fit.getDictionaryObject( "A" );
- if( array == null )
- {
- retval = new PDRange();
- retval.setMin( .5f );
- retval.setMax( .5f );
- setFractionalSpaceToAllocate( retval );
- }
- else
- {
- retval = new PDRange( array );
- }
- return retval;
- }
-
- /**
- * This will set frational space to allocate.
- *
- * @param space The space to allocate.
- */
- public void setFractionalSpaceToAllocate( PDRange space )
- {
- fit.setItem( "A", space );
- }
-
- /**
- * This will tell if the icon should scale to fit the annotation bounds. Default: false
- *
- * @return A flag telling if the icon should scale.
- */
- public boolean shouldScaleToFitAnnotation()
- {
- return fit.getBoolean( "FB", false );
- }
-
- /**
- * This will tell the icon to scale.
- *
- * @param value The flag value.
- */
- public void setScaleToFitAnnotation( boolean value )
- {
- fit.setBoolean( "FB", value );
- }
-} \ No newline at end of file
diff --git a/src/main/java/org/pdfbox/pdmodel/fdf/FDFJavaScript.java b/src/main/java/org/pdfbox/pdmodel/fdf/FDFJavaScript.java
deleted file mode 100644
index dfa6b0f..0000000
--- a/src/main/java/org/pdfbox/pdmodel/fdf/FDFJavaScript.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/**
- * Copyright (c) 2004, www.pdfbox.org
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of pdfbox; nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://www.pdfbox.org
- *
- */
-package org.pdfbox.pdmodel.fdf;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.pdfbox.cos.COSArray;
-import org.pdfbox.cos.COSBase;
-import org.pdfbox.cos.COSDictionary;
-import org.pdfbox.cos.COSName;
-
-import org.pdfbox.pdmodel.common.COSObjectable;
-import org.pdfbox.pdmodel.common.COSArrayList;
-import org.pdfbox.pdmodel.common.PDTextStream;
-import org.pdfbox.pdmodel.common.PDNamedTextStream;
-
-/**
- * This represents an FDF JavaScript dictionary that is part of the FDF document.
- *
- * @author Ben Litchfield (ben@csh.rit.edu)
- * @version $Revision: 1.2 $
- */
-public class FDFJavaScript implements COSObjectable
-{
- private COSDictionary js;
-
- /**
- * Default constructor.
- */
- public FDFJavaScript()
- {
- js = new COSDictionary();
- }
-
- /**
- * Constructor.
- *
- * @param javaScript The FDF java script.
- */
- public FDFJavaScript( COSDictionary javaScript )
- {
- js = javaScript;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSBase getCOSObject()
- {
- return js;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSDictionary getCOSDictionary()
- {
- return js;
- }
-
- /**
- * This will get the javascript that is executed before the import.
- *
- * @return Some javascript code.
- */
- public PDTextStream getBefore()
- {
- return PDTextStream.createTextStream( js.getDictionaryObject( "Before" ) );
- }
-
- /**
- * This will set the javascript code the will get execute before the import.
- *
- * @param before A reference to some javascript code.
- */
- public void setBefore( PDTextStream before )
- {
- js.setItem( "Before", before );
- }
-
- /**
- * This will get the javascript that is executed after the import.
- *
- * @return Some javascript code.
- */
- public PDTextStream getAfter()
- {
- return PDTextStream.createTextStream( js.getDictionaryObject( "After" ) );
- }
-
- /**
- * This will set the javascript code the will get execute after the import.
- *
- * @param after A reference to some javascript code.
- */
- public void setAfter( PDTextStream after )
- {
- js.setItem( "After", after );
- }
-
- /**
- * This will return a list of PDNamedTextStream objects. This is the "Doc"
- * entry of the pdf document. These will be added to the PDF documents
- * javascript name tree. This will not return null.
- *
- * @return A list of all named javascript entries.
- */
- public List getNamedJavaScripts()
- {
- List retval = null;
- COSArray array = (COSArray)js.getDictionaryObject( "Doc" );
- List namedStreams = new ArrayList();
- if( array == null )
- {
- array = new COSArray();
- js.setItem( "Doc", array );
- }
- for( int i=0; i<array.size(); i++ )
- {
- COSName name = (COSName)array.get( i );
- i++;
- COSBase stream = array.get( i );
- PDNamedTextStream namedStream = new PDNamedTextStream( name, stream );
- namedStreams.add( namedStream );
- }
- return new COSArrayList( namedStreams, array );
- }
-
- /**
- * This should be a list of PDNamedTextStream objects.
- *
- * @param namedStreams The named streams.
- */
- public void setNamedJavaScripts( List namedStreams )
- {
- COSArray array = COSArrayList.converterToCOSArray( namedStreams );
- js.setItem( "Doc", array );
- }
-} \ No newline at end of file
diff --git a/src/main/java/org/pdfbox/pdmodel/fdf/FDFNamedPageReference.java b/src/main/java/org/pdfbox/pdmodel/fdf/FDFNamedPageReference.java
deleted file mode 100644
index c03689b..0000000
--- a/src/main/java/org/pdfbox/pdmodel/fdf/FDFNamedPageReference.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * Copyright (c) 2004, www.pdfbox.org
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of pdfbox; nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://www.pdfbox.org
- *
- */
-package org.pdfbox.pdmodel.fdf;
-
-import org.pdfbox.cos.COSBase;
-import org.pdfbox.cos.COSDictionary;
-
-import org.pdfbox.pdmodel.common.COSObjectable;
-
-import org.pdfbox.pdmodel.common.filespecification.PDFileSpecification;;
-
-/**
- * This represents an FDF named page reference that is part of the FDF field.
- *
- * @author Ben Litchfield (ben@csh.rit.edu)
- * @version $Revision: 1.1 $
- */
-public class FDFNamedPageReference implements COSObjectable
-{
- private COSDictionary ref;
-
- /**
- * Default constructor.
- */
- public FDFNamedPageReference()
- {
- ref = new COSDictionary();
- }
-
- /**
- * Constructor.
- *
- * @param r The FDF named page reference dictionary.
- */
- public FDFNamedPageReference( COSDictionary r )
- {
- ref = r;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSBase getCOSObject()
- {
- return ref;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSDictionary getCOSDictionary()
- {
- return ref;
- }
-
- /**
- * This will get the name of the referenced page. A required parameter.
- *
- * @return The name of the referenced page.
- */
- public String getName()
- {
- return ref.getString( "Name" );
- }
-
- /**
- * This will set the name of the referenced page.
- *
- * @param name The referenced page name.
- */
- public void setName( String name )
- {
- ref.setString( "Name", name );
- }
-
- /**
- * This will get the file specification of this reference. An optional parameter.
- *
- * @return The F entry for this dictionary.
- */
- public PDFileSpecification getFileSpecification()
- {
- COSBase fs = ref.getDictionaryObject( "F" );
- return PDFileSpecification.createFS( fs );
- }
-
- /**
- * This will set the file specification for this named page reference.
- *
- * @param fs The file specification to set.
- */
- public void setFileSpecification( PDFileSpecification fs )
- {
- ref.setItem( "F", fs );
- }
-} \ No newline at end of file
diff --git a/src/main/java/org/pdfbox/pdmodel/fdf/FDFOptionElement.java b/src/main/java/org/pdfbox/pdmodel/fdf/FDFOptionElement.java
deleted file mode 100644
index d82a715..0000000
--- a/src/main/java/org/pdfbox/pdmodel/fdf/FDFOptionElement.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * Copyright (c) 2004, www.pdfbox.org
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of pdfbox; nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://www.pdfbox.org
- *
- */
-package org.pdfbox.pdmodel.fdf;
-
-import org.pdfbox.cos.COSArray;
-import org.pdfbox.cos.COSBase;
-import org.pdfbox.cos.COSString;
-
-import org.pdfbox.pdmodel.common.COSObjectable;
-
-/**
- * This represents an object that can be used in a Field's Opt entry to represent
- * an available option and a default appearance string.
- *
- * @author Ben Litchfield (ben@csh.rit.edu)
- * @version $Revision: 1.1 $
- */
-public class FDFOptionElement implements COSObjectable
-{
- private COSArray option;
-
- /**
- * Default constructor.
- */
- public FDFOptionElement()
- {
- option = new COSArray();
- option.add( new COSString( "" ) );
- option.add( new COSString( "" ) );
- }
-
- /**
- * Constructor.
- *
- * @param o The option element.
- */
- public FDFOptionElement( COSArray o )
- {
- option = o;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSBase getCOSObject()
- {
- return option;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSArray getCOSArray()
- {
- return option;
- }
-
- /**
- * This will get the string of one of the available options. A required element.
- *
- * @return An available option.
- */
- public String getOption()
- {
- return ((COSString)option.getObject( 0 ) ).getString();
- }
-
- /**
- * This will set the string for an available option.
- *
- * @param opt One of the available options.
- */
- public void setOption( String opt )
- {
- option.set( 0, new COSString( opt ) );
- }
-
- /**
- * This will get the string of default appearance string. A required element.
- *
- * @return A default appearance string.
- */
- public String getDefaultAppearanceString()
- {
- return ((COSString)option.getObject( 1 ) ).getString();
- }
-
- /**
- * This will set the default appearance string.
- *
- * @param da The default appearance string.
- */
- public void setDefaultAppearanceString( String da )
- {
- option.set( 1, new COSString( da ) );
- }
-} \ No newline at end of file
diff --git a/src/main/java/org/pdfbox/pdmodel/fdf/FDFPage.java b/src/main/java/org/pdfbox/pdmodel/fdf/FDFPage.java
deleted file mode 100644
index 1f5e0b9..0000000
--- a/src/main/java/org/pdfbox/pdmodel/fdf/FDFPage.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/**
- * Copyright (c) 2004, www.pdfbox.org
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of pdfbox; nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://www.pdfbox.org
- *
- */
-package org.pdfbox.pdmodel.fdf;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.pdfbox.cos.COSArray;
-import org.pdfbox.cos.COSBase;
-import org.pdfbox.cos.COSDictionary;
-
-import org.pdfbox.pdmodel.common.COSArrayList;
-import org.pdfbox.pdmodel.common.COSObjectable;
-
-/**
- * This represents an FDF page that is part of the FDF document.
- *
- * @author Ben Litchfield (ben@csh.rit.edu)
- * @version $Revision: 1.2 $
- */
-public class FDFPage implements COSObjectable
-{
- private COSDictionary page;
-
- /**
- * Default constructor.
- */
- public FDFPage()
- {
- page = new COSDictionary();
- }
-
- /**
- * Constructor.
- *
- * @param p The FDF page.
- */
- public FDFPage( COSDictionary p )
- {
- page = p;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSBase getCOSObject()
- {
- return page;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSDictionary getCOSDictionary()
- {
- return page;
- }
-
- /**
- * This will get a list of FDFTemplage objects that describe the named pages
- * that serve as templates.
- *
- * @return A list of templates.
- */
- public List getTemplates()
- {
- List retval = null;
- COSArray array = (COSArray)page.getDictionaryObject( "Templates" );
- if( array != null )
- {
- List objects = new ArrayList();
- for( int i=0; i<array.size(); i++ )
- {
- objects.add( new FDFTemplate( (COSDictionary)array.getObject( i ) ) );
- }
- retval = new COSArrayList( objects, array );
- }
- return retval;
- }
-
- /**
- * A list of FDFTemplate objects.
- *
- * @param templates A list of templates for this Page.
- */
- public void setTemplates( List templates )
- {
- page.setItem( "Templates", COSArrayList.converterToCOSArray( templates ) );
- }
-
- /**
- * This will get the FDF page info object.
- *
- * @return The Page info.
- */
- public FDFPageInfo getPageInfo()
- {
- FDFPageInfo retval = null;
- COSDictionary dict = (COSDictionary)page.getDictionaryObject( "Info" );
- if( dict != null )
- {
- retval = new FDFPageInfo( dict );
- }
- return retval;
- }
-
- /**
- * This will set the page info.
- *
- * @param info The new page info dictionary.
- */
- public void setPageInfo( FDFPageInfo info )
- {
- page.setItem( "Info", info );
- }
-} \ No newline at end of file
diff --git a/src/main/java/org/pdfbox/pdmodel/fdf/FDFPageInfo.java b/src/main/java/org/pdfbox/pdmodel/fdf/FDFPageInfo.java
deleted file mode 100644
index e30441e..0000000
--- a/src/main/java/org/pdfbox/pdmodel/fdf/FDFPageInfo.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Copyright (c) 2004, www.pdfbox.org
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of pdfbox; nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://www.pdfbox.org
- *
- */
-package org.pdfbox.pdmodel.fdf;
-
-import org.pdfbox.cos.COSBase;
-import org.pdfbox.cos.COSDictionary;
-
-import org.pdfbox.pdmodel.common.COSObjectable;
-
-/**
- * This represents an FDF page info that is part of the FDF page.
- *
- * @author Ben Litchfield (ben@csh.rit.edu)
- * @version $Revision: 1.1 $
- */
-public class FDFPageInfo implements COSObjectable
-{
- private COSDictionary pageInfo;
-
- /**
- * Default constructor.
- */
- public FDFPageInfo()
- {
- pageInfo = new COSDictionary();
- }
-
- /**
- * Constructor.
- *
- * @param p The FDF page.
- */
- public FDFPageInfo( COSDictionary p )
- {
- pageInfo = p;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSBase getCOSObject()
- {
- return pageInfo;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSDictionary getCOSDictionary()
- {
- return pageInfo;
- }
-} \ No newline at end of file
diff --git a/src/main/java/org/pdfbox/pdmodel/fdf/FDFTemplate.java b/src/main/java/org/pdfbox/pdmodel/fdf/FDFTemplate.java
deleted file mode 100644
index 217ca30..0000000
--- a/src/main/java/org/pdfbox/pdmodel/fdf/FDFTemplate.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/**
- * Copyright (c) 2004-2005, www.pdfbox.org
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of pdfbox; nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://www.pdfbox.org
- *
- */
-package org.pdfbox.pdmodel.fdf;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.pdfbox.cos.COSArray;
-import org.pdfbox.cos.COSBase;
-import org.pdfbox.cos.COSDictionary;
-
-import org.pdfbox.pdmodel.common.COSArrayList;
-import org.pdfbox.pdmodel.common.COSObjectable;
-
-/**
- * This represents an FDF template that is part of the FDF page.
- *
- * @author Ben Litchfield (ben@benlitchfield.com)
- * @version $Revision: 1.2 $
- */
-public class FDFTemplate implements COSObjectable
-{
- private COSDictionary template;
-
- /**
- * Default constructor.
- */
- public FDFTemplate()
- {
- template = new COSDictionary();
- }
-
- /**
- * Constructor.
- *
- * @param t The FDF page template.
- */
- public FDFTemplate( COSDictionary t )
- {
- template = t;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSBase getCOSObject()
- {
- return template;
- }
-
- /**
- * Convert this standard java object to a COS object.
- *
- * @return The cos object that matches this Java object.
- */
- public COSDictionary getCOSDictionary()
- {
- return template;
- }
-
- /**
- * This is the template reference.
- *
- * @return The template reference.
- */
- public FDFNamedPageReference getTemplateReference()
- {
- FDFNamedPageReference retval = null;
- COSDictionary dict = (COSDictionary)template.getDictionaryObject( "TRef" );
- if( dict != null )
- {
- retval = new FDFNamedPageReference( dict );
- }
- return retval;
- }
-
- /**
- * This will set the template reference.
- *
- * @param tRef The template reference.
- */
- public void setTemplateReference( FDFNamedPageReference tRef )
- {
- template.setItem( "TRef", tRef );
- }
-
- /**
- * This will get a list of fields that are part of this template.
- *
- * @return A list of fields.
- */
- public List getFields()
- {
- List retval = null;
- COSArray array = (COSArray)template.getDictionaryObject( "Fields" );
- if( array != null )
- {
- List fields = new ArrayList();
- for( int i=0; i<array.size(); i++ )
- {
- fields.add( new FDFField( (COSDictionary)array.getObject( i ) ) );
- }
- retval = new COSArrayList( fields, array );
- }
- return retval;
- }
-
- /**
- * This will set a list of fields for this template.
- *
- * @param fields The list of fields to set for this template.
- */
- public void setFields( List fields )
- {
- template.setItem( "Fields", COSArrayList.converterToCOSArray( fields ) );
- }
-
- /**
- * A flag telling if the fields imported from the template may be renamed if there are conflicts.
- *
- * @return A flag telling if the fields can be renamed.
- */
- public boolean shouldRename()
- {
- return template.getBoolean( "Rename", false );
- }
-
- /**
- * This will set if the fields can be renamed.
- *
- * @param value The flag value.
- */
- public void setRename( boolean value )
- {
- template.setBoolean( "Rename", value );
- }
-} \ No newline at end of file
diff --git a/src/main/java/org/pdfbox/pdmodel/fdf/package.html b/src/main/java/org/pdfbox/pdmodel/fdf/package.html
deleted file mode 100644
index e2b6fea..0000000
--- a/src/main/java/org/pdfbox/pdmodel/fdf/package.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-
-</head>
-<body>
-The fdf package will handle all of the logic used for FDF objects inside of the PDF/FDF document.
-</body>
-</html>