You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2013/11/17 16:27:34 UTC

svn commit: r1542748 [3/5] - in /pdfbox/branches/1.8: ./ examples/src/main/java/org/apache/pdfbox/examples/fdf/ examples/src/main/java/org/apache/pdfbox/examples/signature/ fontbox/src/main/java/org/apache/fontbox/cff/ fontbox/src/main/java/org/apache/...

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDXObject.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDXObject.java?rev=1542748&r1=1542747&r2=1542748&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDXObject.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDXObject.java Sun Nov 17 15:27:33 2013
@@ -24,7 +24,6 @@ import org.apache.commons.logging.LogFac
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.cos.COSStream;
-
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.common.COSObjectable;
 import org.apache.pdfbox.pdmodel.common.PDMetadata;
@@ -32,15 +31,14 @@ import org.apache.pdfbox.pdmodel.common.
 
 /**
  * The base class for all XObjects in the PDF document.
- *
+ * 
  * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
  * @author mathiak
  * @author Marcel Kammer
- * @version $Revision: 1.14 $
  */
 public abstract class PDXObject implements COSObjectable
 {
-    
+
     /**
      * Log instance.
      */
@@ -50,40 +48,40 @@ public abstract class PDXObject implemen
 
     /**
      * Standard constructor.
-     *
+     * 
      * @param xobj The XObject dictionary.
      */
     public PDXObject(COSStream xobj)
     {
-        xobject = new PDStream( xobj );
-        xobject.getStream().setName( COSName.TYPE, "XObject" );
+        xobject = new PDStream(xobj);
+        getCOSStream().setItem(COSName.TYPE, COSName.XOBJECT);
     }
 
     /**
      * Standard constuctor.
-     *
+     * 
      * @param xobj The XObject dictionary.
      */
     public PDXObject(PDStream xobj)
     {
         xobject = xobj;
-        xobject.getStream().setName( COSName.TYPE, "XObject" );
+        getCOSStream().setItem(COSName.TYPE, COSName.XOBJECT);
     }
 
     /**
      * Standard constuctor.
-     *
+     * 
      * @param doc The doc to store the object contents.
      */
     public PDXObject(PDDocument doc)
     {
         xobject = new PDStream(doc);
-        xobject.getStream().setName( COSName.TYPE, "XObject" );
+        getCOSStream().setItem(COSName.TYPE, COSName.XOBJECT);
     }
 
     /**
      * Returns the stream.
-     *
+     * 
      * {@inheritDoc}
      */
     public COSBase getCOSObject()
@@ -93,6 +91,7 @@ public abstract class PDXObject implemen
 
     /**
      * Returns the stream.
+     * 
      * @return The stream for this object.
      */
     public COSStream getCOSStream()
@@ -102,6 +101,7 @@ public abstract class PDXObject implemen
 
     /**
      * Returns the stream.
+     * 
      * @return The stream for this object.
      */
     public PDStream getPDStream()
@@ -111,103 +111,125 @@ public abstract class PDXObject implemen
 
     /**
      * Create the correct xobject from the cos base.
-     *
+     * 
      * @param xobject The cos level xobject to create.
-     *
+     * 
      * @return a pdmodel xobject
      * @throws IOException If there is an error creating the xobject.
      */
-    public static PDXObject createXObject( COSBase xobject ) throws IOException
+    public static PDXObject createXObject(COSBase xobject) throws IOException
     {
-        PDXObject retval = commonXObjectCreation(xobject, false);
-        return retval;
+        return commonXObjectCreation(xobject, false);
     }
 
     /**
      * Create the correct xobject from the cos base.
-     *
+     * 
      * @param xobject The cos level xobject to create.
-     * @param isthumb specify if the xobject represent a Thumbnail Image (in this case, the subtype null must be considered as an Image)
+     * @param isthumb specify if the xobject represent a Thumbnail Image (in this case, the subtype null must be
+     * considered as an Image)
      * @return a pdmodel xobject
      * @throws IOException If there is an error creating the xobject.
      */
     protected static PDXObject commonXObjectCreation(COSBase xobject, boolean isThumb)
     {
         PDXObject retval = null;
-        if( xobject == null )
+        if (xobject == null)
         {
             retval = null;
         }
-        else if( xobject instanceof COSStream )
+        else if (xobject instanceof COSStream)
         {
-            COSStream xstream = (COSStream)xobject;
-            String subtype = xstream.getNameAsString( COSName.SUBTYPE );
+            COSStream xstream = (COSStream) xobject;
+            String subtype = xstream.getNameAsString(COSName.SUBTYPE);
             // according to the PDF Reference : a thumbnail subtype must be Image if it is not null
-            if( PDXObjectImage.SUB_TYPE.equals( subtype ) || (subtype == null && isThumb))
+            if (PDXObjectImage.SUB_TYPE.equals(subtype) || (subtype == null && isThumb))
             {
-                PDStream image = new PDStream( xstream );
+                PDStream image = new PDStream(xstream);
                 // See if filters are DCT or JPX otherwise treat as Bitmap-like
                 // There might be a problem with several filters, but that's ToDo until
                 // I find an example
                 List<COSName> filters = image.getFilters();
-                if( filters != null && filters.contains( COSName.DCT_DECODE ) )
+                if (filters != null && filters.contains(COSName.DCT_DECODE))
                 {
                     return new PDJpeg(image);
                 }
-                else if ( filters != null && filters.contains( COSName.CCITTFAX_DECODE ) )
+                else if (filters != null && filters.contains(COSName.CCITTFAX_DECODE))
                 {
                     return new PDCcitt(image);
                 }
-                else if( filters != null && filters.contains(COSName.JPX_DECODE))
+                else if (filters != null && filters.contains(COSName.JPX_DECODE))
                 {
-                    //throw new IOException( "JPXDecode has not been implemented for images" );
-                    //JPX Decode is not really supported right now, but if we are just doing
-                    //text extraction then we don't want to throw an exception, so for now
-                    //just return a PDPixelMap, which will break later on if it is
-                    //actually used, but for text extraction it is not used.
-                    return new PDPixelMap( image );
+                    // throw new IOException( "JPXDecode has not been implemented for images" );
+                    // JPX Decode is not really supported right now, but if we are just doing
+                    // text extraction then we don't want to throw an exception, so for now
+                    // just return a PDPixelMap, which will break later on if it is
+                    // actually used, but for text extraction it is not used.
+                    return new PDPixelMap(image);
                 }
                 else
                 {
                     retval = new PDPixelMap(image);
                 }
             }
-            else if( PDXObjectForm.SUB_TYPE.equals( subtype ) )
+            else if (PDXObjectForm.SUB_TYPE.equals(subtype))
             {
-                retval = new PDXObjectForm( xstream );
+                retval = new PDXObjectForm(xstream);
             }
             else
             {
-                LOG.warn( "Skipping unknown XObject subtype '" + subtype + "'" );
+                LOG.warn("Skipping unknown XObject subtype '" + subtype + "'");
             }
         }
         return retval;
     }
 
     /**
-     * Get the metadata that is part of the document catalog.  This will
-     * return null if there is no meta data for this object.
-     *
+     * Get the metadata that is part of the document catalog. This will return null if there is no meta data for this
+     * object.
+     * 
      * @return The metadata for this object.
      */
     public PDMetadata getMetadata()
     {
         PDMetadata retval = null;
-        COSStream mdStream = (COSStream)xobject.getStream().getDictionaryObject( COSName.METADATA );
-        if( mdStream != null )
+        COSStream mdStream = (COSStream) getCOSStream().getDictionaryObject(COSName.METADATA);
+        if (mdStream != null)
         {
-            retval = new PDMetadata( mdStream );
+            retval = new PDMetadata(mdStream);
         }
         return retval;
     }
 
     /**
-     * Set the metadata for this object.  This can be null.
-     *
+     * Set the metadata for this object. This can be null.
+     * 
      * @param meta The meta data for this object.
      */
-    public void setMetadata( PDMetadata meta )
+    public void setMetadata(PDMetadata meta)
+    {
+        getCOSStream().setItem(COSName.METADATA, meta);
+    }
+
+    /**
+     * This will get the key of this XObject in the structural parent tree. Required if the form XObject is a structural
+     * content item.
+     * 
+     * @return the integer key of the XObject's entry in the structural parent tree
+     */
+    public int getStructParent()
     {
-        xobject.getStream().setItem( COSName.METADATA, meta );
+        return getCOSStream().getInt(COSName.STRUCT_PARENT, 0);
     }
+
+    /**
+     * This will set the key for this XObject in the structural parent tree.
+     * 
+     * @param structParent The new key for this XObject.
+     */
+    public void setStructParent(int structParent)
+    {
+        getCOSStream().setInt(COSName.STRUCT_PARENT, structParent);
+    }
+
 }

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDXObjectForm.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDXObjectForm.java?rev=1542748&r1=1542747&r2=1542748&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDXObjectForm.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDXObjectForm.java Sun Nov 17 15:27:33 2013
@@ -31,7 +31,7 @@ import org.apache.pdfbox.util.Matrix;
 
 /**
  * A form xobject.
- *
+ * 
  * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
  * @version $Revision: 1.6 $
  */
@@ -44,120 +44,118 @@ public class PDXObjectForm extends PDXOb
 
     /**
      * Standard constuctor.
-     *
+     * 
      * @param formStream The XObject is passed as a COSStream.
      */
     public PDXObjectForm(PDStream formStream)
     {
-        super( formStream );
-        getCOSStream().setName( COSName.SUBTYPE, SUB_TYPE );
+        super(formStream);
+        getCOSStream().setName(COSName.SUBTYPE, SUB_TYPE);
     }
 
     /**
      * Standard constuctor.
-     *
+     * 
      * @param formStream The XObject is passed as a COSStream.
      */
     public PDXObjectForm(COSStream formStream)
     {
-        super( formStream );
-        getCOSStream().setName( COSName.SUBTYPE, SUB_TYPE );
+        super(formStream);
+        getCOSStream().setName(COSName.SUBTYPE, SUB_TYPE);
     }
 
     /**
      * This will get the form type, currently 1 is the only form type.
-     *
+     * 
      * @return The form type.
      */
     public int getFormType()
     {
-        return getCOSStream().getInt( "FormType",1 );
+        return getCOSStream().getInt("FormType", 1);
     }
 
     /**
      * Set the form type.
-     *
+     * 
      * @param formType The new form type.
      */
-    public void setFormType( int formType )
+    public void setFormType(int formType)
     {
-        getCOSStream().setInt( "FormType", formType );
+        getCOSStream().setInt("FormType", formType);
     }
 
     /**
-     * This will get the resources at this page and not look up the hierarchy.
-     * This attribute is inheritable, and findResources() should probably used.
-     * This will return null if no resources are available at this level.
-     *
+     * This will get the resources at this page and not look up the hierarchy. This attribute is inheritable, and
+     * findResources() should probably used. This will return null if no resources are available at this level.
+     * 
      * @return The resources at this level in the hierarchy.
      */
     public PDResources getResources()
     {
         PDResources retval = null;
-        COSDictionary resources = (COSDictionary)getCOSStream().getDictionaryObject( COSName.RESOURCES );
-        if( resources != null )
+        COSDictionary resources = (COSDictionary) getCOSStream().getDictionaryObject(COSName.RESOURCES);
+        if (resources != null)
         {
-            retval = new PDResources( resources );
+            retval = new PDResources(resources);
         }
         return retval;
     }
 
     /**
      * This will set the resources for this page.
-     *
+     * 
      * @param resources The new resources for this page.
      */
-    public void setResources( PDResources resources )
+    public void setResources(PDResources resources)
     {
-        getCOSStream().setItem( COSName.RESOURCES, resources );
+        getCOSStream().setItem(COSName.RESOURCES, resources);
     }
 
     /**
-     * An array of four numbers in the form coordinate system (see
-     * below), giving the coordinates of the left, bottom, right, and top edges,
-     * respectively, of the form XObject's bounding box. These boundaries are used
-     * to clip the form XObject and to determine its size for caching.
-     *
+     * An array of four numbers in the form coordinate system (see below), giving the coordinates of the left, bottom,
+     * right, and top edges, respectively, of the form XObject's bounding box. These boundaries are used to clip the
+     * form XObject and to determine its size for caching.
+     * 
      * @return The BBox of the form.
      */
     public PDRectangle getBBox()
     {
         PDRectangle retval = null;
-        COSArray array = (COSArray)getCOSStream().getDictionaryObject( COSName.BBOX );
-        if( array != null )
+        COSArray array = (COSArray) getCOSStream().getDictionaryObject(COSName.BBOX);
+        if (array != null)
         {
-            retval = new PDRectangle( array );
+            retval = new PDRectangle(array);
         }
         return retval;
     }
 
     /**
      * This will set the BBox (bounding box) for this form.
-     *
+     * 
      * @param bbox The new BBox for this form.
      */
     public void setBBox(PDRectangle bbox)
     {
-        if( bbox == null )
+        if (bbox == null)
         {
-            getCOSStream().removeItem( COSName.BBOX );
+            getCOSStream().removeItem(COSName.BBOX);
         }
         else
         {
-            getCOSStream().setItem( COSName.BBOX, bbox.getCOSArray() );
+            getCOSStream().setItem(COSName.BBOX, bbox.getCOSArray());
         }
     }
 
     /**
-     * This will get the optional Matrix of an XObjectForm.
-     * It maps the form space into the user space
+     * This will get the optional Matrix of an XObjectForm. It maps the form space into the user space
+     * 
      * @return the form matrix
      */
     public Matrix getMatrix()
     {
         Matrix retval = null;
-        COSArray array = (COSArray)getCOSStream().getDictionaryObject( COSName.MATRIX );
-        if( array != null )
+        COSArray array = (COSArray) getCOSStream().getDictionaryObject(COSName.MATRIX);
+        if (array != null)
         {
             retval = new Matrix();
             retval.setValue(0, 0, ((COSNumber) array.get(0)).floatValue());
@@ -172,6 +170,7 @@ public class PDXObjectForm extends PDXOb
 
     /**
      * Sets the optional Matrix entry for the form XObject.
+     * 
      * @param transform the transformation matrix
      */
     public void setMatrix(AffineTransform transform)
@@ -181,9 +180,30 @@ public class PDXObjectForm extends PDXOb
         transform.getMatrix(values);
         for (double v : values)
         {
-            matrix.add(new COSFloat((float)v));
+            matrix.add(new COSFloat((float) v));
         }
         getCOSStream().setItem(COSName.MATRIX, matrix);
     }
 
+    /**
+     * This will get the key of this XObjectForm in the structural parent tree. Required if the form XObject contains
+     * marked-content sequences that are structural content items.
+     * 
+     * @return the integer key of the XObjectForm's entry in the structural parent tree
+     */
+    public int getStructParents()
+    {
+        return getCOSStream().getInt(COSName.STRUCT_PARENTS, 0);
+    }
+
+    /**
+     * This will set the key for this XObjectForm in the structural parent tree.
+     * 
+     * @param structParent The new key for this XObjectForm.
+     */
+    public void setStructParents(int structParent)
+    {
+        getCOSStream().setInt(COSName.STRUCT_PARENTS, structParent);
+    }
+
 }

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java?rev=1542748&r1=1542747&r2=1542748&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java Sun Nov 17 15:27:33 2013
@@ -21,28 +21,27 @@ import java.io.IOException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.pdfbox.cos.COSArray;
+import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSName;
-
 import org.apache.pdfbox.pdmodel.PDPage;
 import org.apache.pdfbox.pdmodel.common.COSObjectable;
 import org.apache.pdfbox.pdmodel.common.PDRectangle;
 import org.apache.pdfbox.pdmodel.graphics.color.PDGamma;
 import org.apache.pdfbox.util.BitFlagHelper;
-import org.apache.pdfbox.cos.COSBase;
 
 /**
  * This class represents a PDF annotation.
- *
+ * 
  * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.16 $
+ * 
  */
 public abstract class PDAnnotation implements COSObjectable
 {
     /**
      * Log instance.
      */
-    private static final Log log = LogFactory.getLog(PDAnnotation.class);
+    private static final Log LOG = LogFactory.getLog(PDAnnotation.class);
 
     /**
      * An annotation flag.
@@ -81,88 +80,86 @@ public abstract class PDAnnotation imple
      */
     public static final int FLAG_TOGGLE_NO_VIEW = 1 << 8;
 
-
-
     private COSDictionary dictionary;
 
     /**
      * Create the correct annotation from the base COS object.
-     *
+     * 
      * @param base The COS object that is the annotation.
      * @return The correctly typed annotation object.
      * @throws IOException If there is an error while creating the annotation.
      */
-    // TODO not yet implemented: 
-    // Movie, Screen, PrinterMark, TrapNet, Watermark, 3D, Redact
-    public static PDAnnotation createAnnotation( COSBase base ) throws IOException
+    public static PDAnnotation createAnnotation(COSBase base) throws IOException
     {
         PDAnnotation annot = null;
-        if( base instanceof COSDictionary )
+        if (base instanceof COSDictionary)
         {
-            COSDictionary annotDic = (COSDictionary)base;
-            String subtype = annotDic.getNameAsString( COSName.SUBTYPE );
-            if( PDAnnotationFileAttachment.SUB_TYPE.equals(subtype) )
+            COSDictionary annotDic = (COSDictionary) base;
+            String subtype = annotDic.getNameAsString(COSName.SUBTYPE);
+            if (PDAnnotationFileAttachment.SUB_TYPE.equals(subtype))
             {
-                annot = new PDAnnotationFileAttachment( annotDic );
+                annot = new PDAnnotationFileAttachment(annotDic);
             }
-            else if( PDAnnotationLine.SUB_TYPE.equals(subtype) )
+            else if (PDAnnotationLine.SUB_TYPE.equals(subtype))
             {
-                annot = new PDAnnotationLine( annotDic );
+                annot = new PDAnnotationLine(annotDic);
             }
-            else if( PDAnnotationLink.SUB_TYPE.equals(subtype) )
+            else if (PDAnnotationLink.SUB_TYPE.equals(subtype))
             {
                 annot = new PDAnnotationLink(annotDic);
             }
-            else if( PDAnnotationPopup.SUB_TYPE.equals(subtype) )
+            else if (PDAnnotationPopup.SUB_TYPE.equals(subtype))
             {
                 annot = new PDAnnotationPopup(annotDic);
             }
-            else if( PDAnnotationRubberStamp.SUB_TYPE.equals(subtype) )
+            else if (PDAnnotationRubberStamp.SUB_TYPE.equals(subtype))
             {
                 annot = new PDAnnotationRubberStamp(annotDic);
             }
-            else if( PDAnnotationSquareCircle.SUB_TYPE_SQUARE.equals(subtype) ||
-                    PDAnnotationSquareCircle.SUB_TYPE_CIRCLE.equals(subtype) )
+            else if (PDAnnotationSquareCircle.SUB_TYPE_SQUARE.equals(subtype)
+                    || PDAnnotationSquareCircle.SUB_TYPE_CIRCLE.equals(subtype))
             {
-                annot = new PDAnnotationSquareCircle( annotDic );
+                annot = new PDAnnotationSquareCircle(annotDic);
             }
-            else if( PDAnnotationText.SUB_TYPE.equals(subtype) )
+            else if (PDAnnotationText.SUB_TYPE.equals(subtype))
             {
-                annot = new PDAnnotationText( annotDic);
+                annot = new PDAnnotationText(annotDic);
             }
-            else if( PDAnnotationTextMarkup.SUB_TYPE_HIGHLIGHT.equals(subtype) ||
-                    PDAnnotationTextMarkup.SUB_TYPE_UNDERLINE.equals(subtype) ||
-                    PDAnnotationTextMarkup.SUB_TYPE_SQUIGGLY.equals(subtype) ||
-                    PDAnnotationTextMarkup.SUB_TYPE_STRIKEOUT.equals(subtype) )
+            else if (PDAnnotationTextMarkup.SUB_TYPE_HIGHLIGHT.equals(subtype)
+                    || PDAnnotationTextMarkup.SUB_TYPE_UNDERLINE.equals(subtype)
+                    || PDAnnotationTextMarkup.SUB_TYPE_SQUIGGLY.equals(subtype)
+                    || PDAnnotationTextMarkup.SUB_TYPE_STRIKEOUT.equals(subtype))
             {
-                annot = new PDAnnotationTextMarkup( annotDic );
+                annot = new PDAnnotationTextMarkup(annotDic);
             }
-            else if( PDAnnotationLink.SUB_TYPE.equals(subtype) )
+            else if (PDAnnotationLink.SUB_TYPE.equals(subtype))
             {
-                annot = new PDAnnotationLink( annotDic );
+                annot = new PDAnnotationLink(annotDic);
             }
-            else if( PDAnnotationWidget.SUB_TYPE.equals(subtype) )
+            else if (PDAnnotationWidget.SUB_TYPE.equals(subtype))
             {
-               annot = new PDAnnotationWidget( annotDic );
+                annot = new PDAnnotationWidget(annotDic);
             }
-            else if( PDAnnotationMarkup.SUB_TYPE_FREETEXT.equals(subtype) ||
-                    PDAnnotationMarkup.SUB_TYPE_POLYGON.equals(subtype) ||
-                    PDAnnotationMarkup.SUB_TYPE_POLYLINE.equals(subtype) ||
-                    PDAnnotationMarkup.SUB_TYPE_CARET.equals(subtype) ||
-                    PDAnnotationMarkup.SUB_TYPE_INK.equals(subtype) ||
-                    PDAnnotationMarkup.SUB_TYPE_SOUND.equals(subtype) )
+            else if (PDAnnotationMarkup.SUB_TYPE_FREETEXT.equals(subtype)
+                    || PDAnnotationMarkup.SUB_TYPE_POLYGON.equals(subtype)
+                    || PDAnnotationMarkup.SUB_TYPE_POLYLINE.equals(subtype)
+                    || PDAnnotationMarkup.SUB_TYPE_CARET.equals(subtype)
+                    || PDAnnotationMarkup.SUB_TYPE_INK.equals(subtype)
+                    || PDAnnotationMarkup.SUB_TYPE_SOUND.equals(subtype))
             {
-                annot = new PDAnnotationMarkup( annotDic );
+                annot = new PDAnnotationMarkup(annotDic);
             }
             else
             {
-                annot = new PDAnnotationUnknown( annotDic );
-                log.debug("Unknown or unsupported annotation subtype "+subtype);
+                // TODO not yet implemented:
+                // Movie, Screen, PrinterMark, TrapNet, Watermark, 3D, Redact
+                annot = new PDAnnotationUnknown(annotDic);
+                LOG.debug("Unknown or unsupported annotation subtype " + subtype);
             }
         }
         else
         {
-            throw new IOException( "Error: Unknown annotation type " + base );
+            throw new IOException("Error: Unknown annotation type " + base);
         }
 
         return annot;
@@ -174,21 +171,22 @@ public abstract class PDAnnotation imple
     public PDAnnotation()
     {
         dictionary = new COSDictionary();
-        dictionary.setItem( COSName.TYPE, COSName.ANNOT );
+        dictionary.setItem(COSName.TYPE, COSName.ANNOT);
     }
 
     /**
      * Constructor.
-     *
+     * 
      * @param dict The annotations dictionary.
      */
-    public PDAnnotation( COSDictionary dict )
+    public PDAnnotation(COSDictionary dict)
     {
         dictionary = dict;
     }
 
     /**
      * returns the dictionary.
+     * 
      * @return the dictionary
      */
     public COSDictionary getDictionary()
@@ -197,57 +195,56 @@ public abstract class PDAnnotation imple
     }
 
     /**
-     * The annotation rectangle, defining the location of the annotation
-     * on the page in default user space units.  This is usually required and should
-     * not return null on valid PDF documents.  But where this is a parent form field
-     * with children, such as radio button collections then the rectangle will be null.
-     *
+     * The annotation rectangle, defining the location of the annotation on the page in default user space units. This
+     * is usually required and should not return null on valid PDF documents. But where this is a parent form field with
+     * children, such as radio button collections then the rectangle will be null.
+     * 
      * @return The Rect value of this annotation.
      */
     public PDRectangle getRectangle()
     {
-        COSArray rectArray = (COSArray)dictionary.getDictionaryObject( COSName.RECT );
+        COSArray rectArray = (COSArray) dictionary.getDictionaryObject(COSName.RECT);
         PDRectangle rectangle = null;
-        if( rectArray != null )
+        if (rectArray != null)
         {
-            rectangle = new PDRectangle( rectArray );
+            rectangle = new PDRectangle(rectArray);
         }
         return rectangle;
     }
 
     /**
      * This will set the rectangle for this annotation.
-     *
+     * 
      * @param rectangle The new rectangle values.
      */
-    public void setRectangle( PDRectangle rectangle )
+    public void setRectangle(PDRectangle rectangle)
     {
-        dictionary.setItem( COSName.RECT, rectangle.getCOSArray() );
+        dictionary.setItem(COSName.RECT, rectangle.getCOSArray());
     }
 
-   /**
+    /**
      * This will get the flags for this field.
-     *
+     * 
      * @return flags The set of flags.
      */
     public int getAnnotationFlags()
     {
-        return getDictionary().getInt( COSName.F, 0 );
+        return getDictionary().getInt(COSName.F, 0);
     }
 
     /**
      * This will set the flags for this field.
-     *
+     * 
      * @param flags The new flags.
      */
-    public void setAnnotationFlags( int flags )
+    public void setAnnotationFlags(int flags)
     {
-        getDictionary().setInt( COSName.F, flags );
+        getDictionary().setInt(COSName.F, flags);
     }
 
     /**
      * Interface method for COSObjectable.
-     *
+     * 
      * @return This object as a standard COS object.
      */
     public COSBase getCOSObject()
@@ -257,14 +254,14 @@ public abstract class PDAnnotation imple
 
     /**
      * This will get the name of the current appearance stream if any.
-     *
+     * 
      * @return The name of the appearance stream.
      */
     public String getAppearanceStream()
     {
         String retval = null;
-        COSName name = (COSName)getDictionary().getDictionaryObject( COSName.AS );
-        if( name != null )
+        COSName name = (COSName) getDictionary().getDictionaryObject(COSName.AS);
+        if (name != null)
         {
             retval = name.getName();
         }
@@ -273,236 +270,235 @@ public abstract class PDAnnotation imple
 
     /**
      * This will set the annotations appearance stream name.
-     *
+     * 
      * @param as The name of the appearance stream.
      */
-    public void setAppearanceStream( String as )
+    public void setAppearanceStream(String as)
     {
-        if( as == null )
+        if (as == null)
         {
-            getDictionary().removeItem( COSName.AS );
+            getDictionary().removeItem(COSName.AS);
         }
         else
         {
-            getDictionary().setItem( COSName.AS, COSName.getPDFName( as ) );
+            getDictionary().setItem(COSName.AS, COSName.getPDFName(as));
         }
     }
 
     /**
-     * This will get the appearance dictionary associated with this annotation.
-     * This may return null.
-     *
+     * This will get the appearance dictionary associated with this annotation. This may return null.
+     * 
      * @return This annotations appearance.
      */
     public PDAppearanceDictionary getAppearance()
     {
         PDAppearanceDictionary ap = null;
-        COSDictionary apDic = (COSDictionary)dictionary.getDictionaryObject( COSName.AP );
-        if( apDic != null )
+        COSDictionary apDic = (COSDictionary) dictionary.getDictionaryObject(COSName.AP);
+        if (apDic != null)
         {
-            ap = new PDAppearanceDictionary( apDic );
+            ap = new PDAppearanceDictionary(apDic);
         }
         return ap;
     }
 
     /**
      * This will set the appearance associated with this annotation.
-     *
+     * 
      * @param appearance The appearance dictionary for this annotation.
      */
-    public void setAppearance( PDAppearanceDictionary appearance )
+    public void setAppearance(PDAppearanceDictionary appearance)
     {
         COSDictionary ap = null;
-        if( appearance != null )
+        if (appearance != null)
         {
             ap = appearance.getDictionary();
         }
-        dictionary.setItem( COSName.AP, ap );
+        dictionary.setItem(COSName.AP, ap);
     }
 
     /**
      * Get the invisible flag.
-     *
+     * 
      * @return The invisible flag.
      */
     public boolean isInvisible()
     {
-        return BitFlagHelper.getFlag( getDictionary(), COSName.F, FLAG_INVISIBLE );
+        return BitFlagHelper.getFlag(getDictionary(), COSName.F, FLAG_INVISIBLE);
     }
 
     /**
      * Set the invisible flag.
-     *
+     * 
      * @param invisible The new invisible flag.
      */
-    public void setInvisible( boolean invisible )
+    public void setInvisible(boolean invisible)
     {
-        BitFlagHelper.setFlag( getDictionary(), COSName.F, FLAG_INVISIBLE, invisible );
+        BitFlagHelper.setFlag(getDictionary(), COSName.F, FLAG_INVISIBLE, invisible);
     }
 
     /**
      * Get the hidden flag.
-     *
+     * 
      * @return The hidden flag.
      */
     public boolean isHidden()
     {
-        return BitFlagHelper.getFlag( getDictionary(), COSName.F, FLAG_HIDDEN );
+        return BitFlagHelper.getFlag(getDictionary(), COSName.F, FLAG_HIDDEN);
     }
 
     /**
      * Set the hidden flag.
-     *
+     * 
      * @param hidden The new hidden flag.
      */
-    public void setHidden( boolean hidden )
+    public void setHidden(boolean hidden)
     {
-        BitFlagHelper.setFlag( getDictionary(), COSName.F, FLAG_HIDDEN, hidden );
+        BitFlagHelper.setFlag(getDictionary(), COSName.F, FLAG_HIDDEN, hidden);
     }
 
     /**
      * Get the printed flag.
-     *
+     * 
      * @return The printed flag.
      */
     public boolean isPrinted()
     {
-        return BitFlagHelper.getFlag( getDictionary(), COSName.F, FLAG_PRINTED );
+        return BitFlagHelper.getFlag(getDictionary(), COSName.F, FLAG_PRINTED);
     }
 
     /**
      * Set the printed flag.
-     *
+     * 
      * @param printed The new printed flag.
      */
-    public void setPrinted( boolean printed )
+    public void setPrinted(boolean printed)
     {
-        BitFlagHelper.setFlag( getDictionary(), COSName.F, FLAG_PRINTED, printed );
+        BitFlagHelper.setFlag(getDictionary(), COSName.F, FLAG_PRINTED, printed);
     }
 
     /**
      * Get the noZoom flag.
-     *
+     * 
      * @return The noZoom flag.
      */
     public boolean isNoZoom()
     {
-        return BitFlagHelper.getFlag( getDictionary(), COSName.F, FLAG_NO_ZOOM );
+        return BitFlagHelper.getFlag(getDictionary(), COSName.F, FLAG_NO_ZOOM);
     }
 
     /**
      * Set the noZoom flag.
-     *
+     * 
      * @param noZoom The new noZoom flag.
      */
-    public void setNoZoom( boolean noZoom )
+    public void setNoZoom(boolean noZoom)
     {
-        BitFlagHelper.setFlag( getDictionary(), COSName.F, FLAG_NO_ZOOM, noZoom );
+        BitFlagHelper.setFlag(getDictionary(), COSName.F, FLAG_NO_ZOOM, noZoom);
     }
 
     /**
      * Get the noRotate flag.
-     *
+     * 
      * @return The noRotate flag.
      */
     public boolean isNoRotate()
     {
-        return BitFlagHelper.getFlag( getDictionary(), COSName.F, FLAG_NO_ROTATE );
+        return BitFlagHelper.getFlag(getDictionary(), COSName.F, FLAG_NO_ROTATE);
     }
 
     /**
      * Set the noRotate flag.
-     *
+     * 
      * @param noRotate The new noRotate flag.
      */
-    public void setNoRotate( boolean noRotate )
+    public void setNoRotate(boolean noRotate)
     {
-        BitFlagHelper.setFlag( getDictionary(), COSName.F, FLAG_NO_ROTATE, noRotate );
+        BitFlagHelper.setFlag(getDictionary(), COSName.F, FLAG_NO_ROTATE, noRotate);
     }
 
     /**
      * Get the noView flag.
-     *
+     * 
      * @return The noView flag.
      */
     public boolean isNoView()
     {
-        return BitFlagHelper.getFlag( getDictionary(), COSName.F, FLAG_NO_VIEW );
+        return BitFlagHelper.getFlag(getDictionary(), COSName.F, FLAG_NO_VIEW);
     }
 
     /**
      * Set the noView flag.
-     *
+     * 
      * @param noView The new noView flag.
      */
-    public void setNoView( boolean noView )
+    public void setNoView(boolean noView)
     {
-        BitFlagHelper.setFlag( getDictionary(), COSName.F, FLAG_NO_VIEW, noView );
+        BitFlagHelper.setFlag(getDictionary(), COSName.F, FLAG_NO_VIEW, noView);
     }
 
     /**
      * Get the readOnly flag.
-     *
+     * 
      * @return The readOnly flag.
      */
     public boolean isReadOnly()
     {
-        return BitFlagHelper.getFlag( getDictionary(), COSName.F, FLAG_READ_ONLY );
+        return BitFlagHelper.getFlag(getDictionary(), COSName.F, FLAG_READ_ONLY);
     }
 
     /**
      * Set the readOnly flag.
-     *
+     * 
      * @param readOnly The new readOnly flag.
      */
-    public void setReadOnly( boolean readOnly )
+    public void setReadOnly(boolean readOnly)
     {
-        BitFlagHelper.setFlag( getDictionary(), COSName.F, FLAG_READ_ONLY, readOnly );
+        BitFlagHelper.setFlag(getDictionary(), COSName.F, FLAG_READ_ONLY, readOnly);
     }
 
     /**
      * Get the locked flag.
-     *
+     * 
      * @return The locked flag.
      */
     public boolean isLocked()
     {
-        return BitFlagHelper.getFlag( getDictionary(), COSName.F, FLAG_LOCKED );
+        return BitFlagHelper.getFlag(getDictionary(), COSName.F, FLAG_LOCKED);
     }
 
     /**
      * Set the locked flag.
-     *
+     * 
      * @param locked The new locked flag.
      */
-    public void setLocked( boolean locked )
+    public void setLocked(boolean locked)
     {
-        BitFlagHelper.setFlag( getDictionary(), COSName.F, FLAG_LOCKED, locked );
+        BitFlagHelper.setFlag(getDictionary(), COSName.F, FLAG_LOCKED, locked);
     }
 
     /**
      * Get the toggleNoView flag.
-     *
+     * 
      * @return The toggleNoView flag.
      */
     public boolean isToggleNoView()
     {
-        return BitFlagHelper.getFlag( getDictionary(), COSName.F, FLAG_TOGGLE_NO_VIEW );
+        return BitFlagHelper.getFlag(getDictionary(), COSName.F, FLAG_TOGGLE_NO_VIEW);
     }
 
     /**
      * Set the toggleNoView flag.
-     *
+     * 
      * @param toggleNoView The new toggleNoView flag.
      */
-    public void setToggleNoView( boolean toggleNoView )
+    public void setToggleNoView(boolean toggleNoView)
     {
-        BitFlagHelper.setFlag( getDictionary(), COSName.F, FLAG_TOGGLE_NO_VIEW, toggleNoView );
+        BitFlagHelper.setFlag(getDictionary(), COSName.F, FLAG_TOGGLE_NO_VIEW, toggleNoView);
     }
 
     /**
      * Get the "contents" of the field.
-     *
+     * 
      * @return the value of the contents.
      */
     public String getContents()
@@ -512,93 +508,105 @@ public abstract class PDAnnotation imple
 
     /**
      * Set the "contents" of the field.
-     *
+     * 
      * @param value the value of the contents.
      */
-    public void setContents( String value)
+    public void setContents(String value)
     {
         dictionary.setString(COSName.CONTENTS, value);
     }
 
     /**
      * This will retrieve the date and time the annotation was modified.
-     *
+     * 
      * @return the modified date/time (often in date format, but can be an arbitary string).
      */
     public String getModifiedDate()
     {
-        return getDictionary().getString( COSName.M );
+        return getDictionary().getString(COSName.M);
     }
 
     /**
      * This will set the the date and time the annotation was modified.
-     *
-     * @param m
-     *            the date and time the annotation was created.
+     * 
+     * @param m the date and time the annotation was created.
      */
-    public void setModifiedDate( String m )
+    public void setModifiedDate(String m)
     {
-        getDictionary().setString( COSName.M, m );
+        getDictionary().setString(COSName.M, m);
     }
 
     /**
-     * This will get the name, a string intended to uniquely identify each annotation
-     * within a page. Not to be confused with some annotations Name entry which
-     * impact the default image drawn for them.
-     *
+     * This will get the name, a string intended to uniquely identify each annotation within a page. Not to be confused
+     * with some annotations Name entry which impact the default image drawn for them.
+     * 
      * @return The identifying name for the Annotation.
      */
     public String getAnnotationName()
     {
-        return getDictionary().getString( COSName.NM );
+        return getDictionary().getString(COSName.NM);
     }
 
     /**
-     * This will set the name, a string intended to uniquely identify each annotation
-     * within a page. Not to be confused with some annotations Name entry which
-     * impact the default image drawn for them.
-     *
+     * This will set the name, a string intended to uniquely identify each annotation within a page. Not to be confused
+     * with some annotations Name entry which impact the default image drawn for them.
+     * 
      * @param nm The identifying name for the annotation.
      */
-    public void setAnnotationName( String nm )
+    public void setAnnotationName(String nm)
     {
-        getDictionary().setString( COSName.NM, nm );
+        getDictionary().setString(COSName.NM, nm);
     }
 
     /**
-     * This will set the colour used in drawing various elements.
-     * As of PDF 1.6 these are : Background of icon when closed
-     *                           Title bar of popup window
-     *                           Border of a link annotation
-     *
+     * This will get the key of this annotation in the structural parent tree.
+     * 
+     * @return the integer key of the annotation's entry in the structural parent tree
+     */
+    public int getStructParent()
+    {
+        return getDictionary().getInt(COSName.STRUCT_PARENT, 0);
+    }
+
+    /**
+     * This will set the key for this annotation in the structural parent tree.
+     * 
+     * @param structParent The new key for this annotation.
+     */
+    public void setStructParent(int structParent)
+    {
+        getDictionary().setInt(COSName.STRUCT_PARENT, structParent);
+    }
+
+    /**
+     * This will set the colour used in drawing various elements. As of PDF 1.6 these are : Background of icon when
+     * closed Title bar of popup window Border of a link annotation
+     * 
      * Colour is in DeviceRGB colourspace
-     *
-     * @param c
-     *            colour in the DeviceRGB colourspace
-     *
+     * 
+     * @param c colour in the DeviceRGB colourspace
+     * 
      */
-    public void setColour( PDGamma c )
+    public void setColour(PDGamma c)
     {
-        getDictionary().setItem( COSName.C, c );
+        getDictionary().setItem(COSName.C, c);
     }
 
     /**
-     * This will retrieve the colour used in drawing various elements.
-     * As of PDF 1.6 these are : Background of icon when closed
-     *                           Title bar of popup window
-     *                           Border of a link annotation
-     *
+     * This will retrieve the colour used in drawing various elements. As of PDF 1.6 these are : Background of icon when
+     * closed Title bar of popup window Border of a link annotation
+     * 
      * Colour is in DeviceRGB colourspace
-     *
+     * 
      * @return PDGamma object representing the colour
-     *
+     * 
      */
     public PDGamma getColour()
     {
-        COSArray c = (COSArray) getDictionary().getItem(COSName.C );
+        COSArray c = (COSArray) getDictionary().getItem(COSName.C);
         if (c != null)
         {
-            return new PDGamma( c );
+            return new PDGamma(c);
         }
         else
         {
@@ -606,7 +614,7 @@ public abstract class PDAnnotation imple
         }
     }
 
-    /** 
+    /**
      * This will retrieve the subtype of the annotation.
      * 
      * @return the subtype
@@ -625,7 +633,7 @@ public abstract class PDAnnotation imple
     {
         this.getDictionary().setItem(COSName.P, page);
     }
-    
+
     /**
      * This will retrieve the corresponding page of this annotation.
      * 

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java?rev=1542748&r1=1542747&r2=1542748&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/SignatureOptions.java Sun Nov 17 15:27:33 2013
@@ -21,6 +21,7 @@ import java.io.InputStream;
 
 import org.apache.pdfbox.cos.COSDocument;
 import org.apache.pdfbox.pdfparser.VisualSignatureParser;
+import org.apache.pdfbox.pdmodel.interactive.digitalsignature.visible.PDVisibleSigProperties;
 
 
 public class SignatureOptions
@@ -65,6 +66,20 @@ public class SignatureOptions
         visParser.parse();
         visualSignature = visParser.getDocument();
     }
+    
+    /**
+     * Reads the visual signature from the given visual signature properties
+     *  
+     * @param is the <code>PDVisibleSigProperties</code> object containing the visual signature
+     * 
+     * @throws IOException when something went wrong during parsing
+     * 
+     * @since 1.8.3
+     */
+    public void setVisualSignature(PDVisibleSigProperties visSignatureProperties) throws IOException
+    { 
+        setVisualSignature(visSignatureProperties.getVisibleSignature());
+    }
 
     /**
      * Get the visual signature.

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java?rev=1542748&r1=1541625&r2=1542748&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateCreator.java Sun Nov 17 15:27:33 2013
@@ -23,7 +23,6 @@ import java.io.InputStream;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.pdfbox.cos.COSDocument;
 import org.apache.pdfbox.exceptions.COSVisitorException;
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.PDPage;
@@ -35,9 +34,8 @@ import org.apache.pdfbox.pdmodel.interac
 import org.apache.pdfbox.pdmodel.interactive.form.PDSignatureField;
 
 /**
- * 
- * @author Vakhtang koroghlishvili (Gogebashvili)
- * 
+ * Using that class, we  build pdf template
+ * @author <a href="mailto:vakhtang.koroghlishvili@gmail.com"> vakhtang koroghlishvili (gogebashvili) </a>
  */
 public class PDFTemplateCreator
 {
@@ -66,8 +64,7 @@ public class PDFTemplateCreator
     }
 
     /**
-     * this method build pdf, step by step, and finally it returns stream of visible signature
-     * 
+     * this method builds pdf  step by step, and finally it returns stream of visible signature
      * @param properties
      * @return InputStream
      * @throws IOException
@@ -79,45 +76,70 @@ public class PDFTemplateCreator
         logger.info("pdf building has been started");
         PDFTemplateStructure pdfStructure = pdfBuilder.getStructure();
 
+        // we create array of [Text, ImageB, ImageC, ImageI]
         this.pdfBuilder.createProcSetArray();
+        
+        //create page
         this.pdfBuilder.createPage(properties);
         PDPage page = pdfStructure.getPage();
 
+        //create template
         this.pdfBuilder.createTemplate(page);
         PDDocument template = pdfStructure.getTemplate();
+        
+        //create /AcroForm
         this.pdfBuilder.createAcroForm(template);
         PDAcroForm acroForm = pdfStructure.getAcroForm();
 
+        // AcroForm contains singature fields
         this.pdfBuilder.createSignatureField(acroForm);
         PDSignatureField pdSignatureField = pdfStructure.getSignatureField();
+        
+        // create signature
         this.pdfBuilder.createSignature(pdSignatureField, page, properties.getSignatureFieldName());
+       
+        // that is /AcroForm/DR entry
         this.pdfBuilder.createAcroFormDictionary(acroForm, pdSignatureField);
+        
+        // create AffineTransform
         this.pdfBuilder.createAffineTransform(properties.getAffineTransformParams());
         AffineTransform transform = pdfStructure.getAffineTransform();
+       
+        // rectangle, formatter, image. /AcroForm/DR/XObject contains that form
         this.pdfBuilder.createSignatureRectangle(pdSignatureField, properties);
         this.pdfBuilder.createFormaterRectangle(properties.getFormaterRectangleParams());
         PDRectangle formater = pdfStructure.getFormaterRectangle();
-
         this.pdfBuilder.createSignatureImage(template, properties.getImageStream());
 
+        // create form stream, form and  resource. 
         this.pdfBuilder.createHolderFormStream(template);
         PDStream holderFormStream = pdfStructure.getHolderFormStream();
         this.pdfBuilder.createHolderFormResources();
         PDResources holderFormResources = pdfStructure.getHolderFormResources();
         this.pdfBuilder.createHolderForm(holderFormResources, holderFormStream, formater);
+        
+        // that is /AP entry the appearance dictionary.
         this.pdfBuilder.createAppearanceDictionary(pdfStructure.getHolderForm(), pdSignatureField);
+        
+        // inner formstream, form and resource (hlder form containts inner form)
         this.pdfBuilder.createInnerFormStream(template);
         this.pdfBuilder.createInnerFormResource();
         PDResources innerFormResource = pdfStructure.getInnerFormResources();
         this.pdfBuilder.createInnerForm(innerFormResource, pdfStructure.getInnterFormStream(), formater);
         PDXObjectForm innerForm = pdfStructure.getInnerForm();
+       
+        // inner form must be in the holder form as we wrote
         this.pdfBuilder.insertInnerFormToHolerResources(innerForm, holderFormResources);
+        
+        //  Image form is in this structure: /AcroForm/DR/FRM0/Resources/XObject/n0
         this.pdfBuilder.createImageFormStream(template);
         PDStream imageFormStream = pdfStructure.getImageFormStream();
         this.pdfBuilder.createImageFormResources();
         PDResources imageFormResources = pdfStructure.getImageFormResources();
         this.pdfBuilder.createImageForm(imageFormResources, innerFormResource, imageFormStream, formater, transform,
                 pdfStructure.getJpedImage());
+       
+        // now inject procSetArray
         this.pdfBuilder.injectProcSetArray(innerForm, page, innerFormResource, imageFormResources, holderFormResources,
                 pdfStructure.getProcSet());
 
@@ -125,6 +147,7 @@ public class PDFTemplateCreator
         String imgName = pdfStructure.getImageName();
         String innerFormName = pdfStructure.getInnerFormName();
 
+        // now create Streams of AP
         this.pdfBuilder.injectAppearanceStreams(holderFormStream, imageFormStream, imageFormStream, imgFormName,
                 imgName, innerFormName, properties);
         this.pdfBuilder.createVisualSignature(template);
@@ -133,16 +156,18 @@ public class PDFTemplateCreator
         ByteArrayInputStream in = null;
         try
         {
-            in = pdfStructure.templateAppearanceStream();
+            in = pdfStructure.getTemplateAppearanceStream();
         }
         catch (COSVisitorException e)
         {
-            logger.error("COSVisitorException: cant get apereance stream ", e);
+            logger.error("COSVisitorException: can't get apereance stream ", e);
         }
         logger.info("stream returning started, size= " + in.available());
         
+        // we must close the document
         template.close();
         
+        // return result of the stream 
         return in;
 
     }

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateStructure.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateStructure.java?rev=1542748&r1=1541625&r2=1542748&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateStructure.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateStructure.java Sun Nov 17 15:27:33 2013
@@ -43,7 +43,7 @@ import org.apache.pdfbox.pdmodel.interac
 /**
  * Structure of PDF document with visible signature
  * 
- * @author Vakhtang koroghlishvili (Gogebashvili)
+ * @author <a href="mailto:vakhtang.koroghlishvili@gmail.com"> vakhtang koroghlishvili (gogebashvili) </a>
  * 
  */
 public class PDFTemplateStructure
@@ -77,270 +77,509 @@ public class PDFTemplateStructure
     private PDXObjectForm imageForm;
     private COSDictionary widgetDictionary;
 
+    /**
+     * Returns document page.
+     * @return
+     */
     public PDPage getPage()
     {
         return page;
     }
 
+    /**
+     * Sets document page
+     * @param page
+     */
     public void setPage(PDPage page)
     {
         this.page = page;
     }
 
+    /**
+     * Gets PDDocument template.
+     * This represents a digital signature
+     *  that can be attached to a document
+     * @return
+     */
     public PDDocument getTemplate()
     {
         return template;
     }
 
+    /**
+     * Wets PDDocument template.
+     * This represents a digital signature
+     * that can be attached to a document
+     * @param template
+     */
     public void setTemplate(PDDocument template)
     {
         this.template = template;
     }
 
+    /**
+     * Gets Acroform
+     * @return
+     */
     public PDAcroForm getAcroForm()
     {
         return acroForm;
     }
 
+    /**
+     * Sets Acroform
+     * @param acroForm
+     */
     public void setAcroForm(PDAcroForm acroForm)
     {
         this.acroForm = acroForm;
     }
 
+    /**
+     * Gets Signature field
+     * @return
+     */
     public PDSignatureField getSignatureField()
     {
         return signatureField;
     }
 
+    /**
+     * Sets signature field
+     * @param signatureField
+     */
     public void setSignatureField(PDSignatureField signatureField)
     {
         this.signatureField = signatureField;
     }
 
+    /**
+     * Gets PDSignature
+     * @return
+     */
     public PDSignature getPdSignature()
     {
         return pdSignature;
     }
 
+    /**
+     * Sets PDSignature
+     * @param pdSignature
+     */
     public void setPdSignature(PDSignature pdSignature)
     {
         this.pdSignature = pdSignature;
     }
 
+    /**
+     * Gets Dictionary of AcroForm. Thats <b> /DR </b>
+     * entry in the AcroForm
+     * @return
+     */
     public COSDictionary getAcroFormDictionary()
     {
         return acroFormDictionary;
     }
 
+    /**
+     * Acroform have its Dictionary, so we here set
+     * the Dictionary  which is in this location:
+     * <b> AcroForm/DR <b>
+     * @param acroFormDictionary
+     */
     public void setAcroFormDictionary(COSDictionary acroFormDictionary)
     {
         this.acroFormDictionary = acroFormDictionary;
     }
 
+    /**
+     * Gets SignatureRectangle
+     * @return
+     */
     public PDRectangle getSingatureRectangle()
     {
         return singatureRectangle;
     }
 
+    /**
+     * Sets SignatureRectangle
+     * @param singatureRectangle
+     */
     public void setSignatureRectangle(PDRectangle singatureRectangle)
     {
         this.singatureRectangle = singatureRectangle;
     }
 
+    /**
+     * Gets AffineTransform
+     * @return
+     */
     public AffineTransform getAffineTransform()
     {
         return affineTransform;
     }
 
+    /**
+     * Sets AffineTransform
+     * @param affineTransform
+     */
     public void setAffineTransform(AffineTransform affineTransform)
     {
         this.affineTransform = affineTransform;
     }
 
+    /**
+     * Gets ProcSet Array
+     * @return
+     */
     public COSArray getProcSet()
     {
         return procSet;
     }
 
+    /**
+     * Sets ProcSet Array
+     * @param procSet
+     */
     public void setProcSet(COSArray procSet)
     {
         this.procSet = procSet;
     }
 
+    /**
+     * Gets the image of visible signature
+     * @return
+     */
     public PDJpeg getJpedImage()
     {
         return jpedImage;
     }
 
+    /**
+     * Sets the image of visible signature
+     * @param jpedImage
+     */
     public void setJpedImage(PDJpeg jpedImage)
     {
         this.jpedImage = jpedImage;
     }
 
+    /**
+     * Gets formatter rectangle
+     * @return
+     */
     public PDRectangle getFormaterRectangle()
     {
         return formaterRectangle;
     }
 
+    /**
+     * Sets formatter rectangle
+     * @param formaterRectangle
+     */
     public void setFormaterRectangle(PDRectangle formaterRectangle)
     {
         this.formaterRectangle = formaterRectangle;
     }
 
+    /**
+     * Sets HolderFormStream
+     * @return
+     */
     public PDStream getHolderFormStream()
     {
         return holderFormStream;
     }
 
+    /**
+     * Sets stream of holder form Stream 
+     * @param holderFormStream
+     */
     public void setHolderFormStream(PDStream holderFormStream)
     {
         this.holderFormStream = holderFormStream;
     }
 
+    /**
+     * Gets Holder form.
+     * That form is here <b> AcroForm/DR/XObject/{holder form name} </b>
+     * By default, name stars with FRM. We also add number of form
+     * to the name.
+     * @return
+     */
     public PDXObjectForm getHolderForm()
     {
         return holderForm;
     }
 
+    /**
+     * In the structure, form will be contained by XObject in the <b>AcroForm/DR/ </b>
+     * @param holderForm
+     */
     public void setHolderForm(PDXObjectForm holderForm)
     {
         this.holderForm = holderForm;
     }
 
+    /**
+     * Gets Holder form resources
+     * @return
+     */
     public PDResources getHolderFormResources()
     {
         return holderFormResources;
     }
 
+    /**
+     * Sets holder form resources
+     * @param holderFormResources
+     */
     public void setHolderFormResources(PDResources holderFormResources)
     {
         this.holderFormResources = holderFormResources;
     }
 
+    /**
+     * Gets AppearanceDictionary
+     * That is <b>/AP</b> entry the appearance dictionary.
+     * @return
+     */
     public PDAppearanceDictionary getAppearanceDictionary()
     {
         return appearanceDictionary;
     }
 
+    /**
+     * Sets AppearanceDictionary
+     * That is <b>/AP</b> entry the appearance dictionary.
+     * @param appearanceDictionary
+     */
     public void setAppearanceDictionary(PDAppearanceDictionary appearanceDictionary)
     {
         this.appearanceDictionary = appearanceDictionary;
     }
 
+    /**
+     * Gets Inner form Stream.
+     * @return
+     */
     public PDStream getInnterFormStream()
     {
         return innterFormStream;
     }
 
+    /**
+     * Sets inner form stream
+     * @param innterFormStream
+     */
     public void setInnterFormStream(PDStream innterFormStream)
     {
         this.innterFormStream = innterFormStream;
     }
 
+    /**
+     * Gets inner form Resource
+     * @return
+     */
     public PDResources getInnerFormResources()
     {
         return innerFormResources;
     }
 
+    /**
+     * Sets inner form resource
+     * @param innerFormResources
+     */
     public void setInnerFormResources(PDResources innerFormResources)
     {
         this.innerFormResources = innerFormResources;
     }
 
+    /**
+     * Gets inner form that is in this location:
+     * <b> AcroForm/DR/XObject/{holder form name}/Resources/XObject/{inner name} </b>
+     * By default inner form name starts with "n". Then we add number of form
+     * to the name.
+     * @return
+     */
     public PDXObjectForm getInnerForm()
     {
         return innerForm;
     }
 
+    /**
+     * sets inner form to this location:
+     * <b> AcroForm/DR/XObject/{holder form name}/Resources/XObject/{destination} </b>
+     * @param innerForm
+     */
     public void setInnerForm(PDXObjectForm innerForm)
     {
         this.innerForm = innerForm;
     }
 
+    /**
+     * Gets name of inner form
+     * @return
+     */
     public String getInnerFormName()
     {
         return innerFormName;
     }
 
+    /**
+     * Sets inner form name
+     * @param innerFormName
+     */
     public void setInnerFormName(String innerFormName)
     {
         this.innerFormName = innerFormName;
     }
 
+    /**
+     * Gets Image form stream
+     * @return
+     */
     public PDStream getImageFormStream()
     {
         return imageFormStream;
     }
 
+    /**
+     * Sets image form stream
+     * @param imageFormStream
+     */
     public void setImageFormStream(PDStream imageFormStream)
     {
         this.imageFormStream = imageFormStream;
     }
 
+    /**
+     * Gets image form resources
+     * @return
+     */
     public PDResources getImageFormResources()
     {
         return imageFormResources;
     }
 
+    /**
+     * Sets image form resource
+     * @param imageFormResources
+     */
     public void setImageFormResources(PDResources imageFormResources)
     {
         this.imageFormResources = imageFormResources;
     }
 
+    /**
+     * Gets Image form. Image form is in this structure: 
+     * <b>/AcroForm/DR/{holder form}/Resources/XObject /{inner form} </b>
+     * /Resources/XObject/{image form name}.
+     * @return
+     */
     public PDXObjectForm getImageForm()
     {
         return imageForm;
     }
 
+    /**
+     * Sets Image form. Image form will be in this structure: 
+     * <b>/AcroForm/DR/{holder form}/Resources/XObject /{inner form}
+     * /Resources/XObject/{image form name}.</b> By default we start
+     *  image form name with "img". Then we  add number of image 
+     *  form to the form name.
+     * Sets image form
+     * @param imageForm
+     */
     public void setImageForm(PDXObjectForm imageForm)
     {
         this.imageForm = imageForm;
     }
 
+    /**
+     * Gets image form name
+     * @return
+     */
     public String getImageFormName()
     {
         return imageFormName;
     }
 
+    /**
+     * Sets image form name
+     * @param imageFormName
+     */
     public void setImageFormName(String imageFormName)
     {
         this.imageFormName = imageFormName;
     }
 
+    /**
+     * Gets visible signature image name
+     * @return
+     */
     public String getImageName()
     {
         return imageName;
     }
 
+    /**
+     * Sets visible signature image name
+     * @param imageName
+     */
     public void setImageName(String imageName)
     {
         this.imageName = imageName;
     }
 
+    /**
+     * Gets COSDocument of visible Signature.
+     * @see org.apache.pdfbox.cos.COSDocument
+     * @return
+     */
     public COSDocument getVisualSignature()
     {
         return visualSignature;
     }
 
+    /**
+     * 
+     * Sets COSDocument of visible Signature.
+     * @see org.apache.pdfbox.cos.COSDocument
+     * @param visualSignature
+     */
     public void setVisualSignature(COSDocument visualSignature)
     {
         this.visualSignature = visualSignature;
     }
 
+    /**
+     * Gets acroFormFields
+     * @return
+     */
     public List<PDField> getAcroFormFields()
     {
         return acroFormFields;
     }
 
+    /**
+     * Sets acroFormFields
+     * @param acroFormFields
+     */
     public void setAcroFormFields(List<PDField> acroFormFields)
     {
         this.acroFormFields = acroFormFields;
     }
     
-    public ByteArrayInputStream templateAppearanceStream() throws IOException, COSVisitorException
+   /**
+    * Gets AP of the created template
+    * @return
+    * @throws IOException
+    * @throws COSVisitorException
+    */
+    public ByteArrayInputStream getTemplateAppearanceStream() throws IOException, COSVisitorException
     {
         COSDocument visualSignature = getVisualSignature();
-
         ByteArrayOutputStream memoryOut = new ByteArrayOutputStream();
         COSWriter memoryWriter = new COSWriter(memoryOut);
         memoryWriter.write(visualSignature);
@@ -352,11 +591,23 @@ public class PDFTemplateStructure
         return input;
     }
 
+    /**
+     * Gets Widget Dictionary.
+     * {@link org.apache.pdfbox.pdmodel.interactive.form.PDField}
+     * @see org.apache.pdfbox.pdmodel.interactive.form.PDField.getWidget() 
+     * @return
+     */
     public COSDictionary getWidgetDictionary()
     {
         return widgetDictionary;
     }
 
+    /**
+     * Sets Widget Dictionary.
+     * {@link org.apache.pdfbox.pdmodel.interactive.form.PDField}
+     * @see org.apache.pdfbox.pdmodel.interactive.form.PDField.getWidget() 
+     * @param widgetDictionary
+     */
     public void setWidgetDictionary(COSDictionary widgetDictionary)
     {
         this.widgetDictionary = widgetDictionary;

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java?rev=1542748&r1=1541625&r2=1542748&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java Sun Nov 17 15:27:33 2013
@@ -42,8 +42,9 @@ import org.apache.pdfbox.pdmodel.interac
 import org.apache.pdfbox.pdmodel.interactive.form.PDSignatureField;
 
 /**
- * 
- * @author Vakhtang koroghlishvili (Gogebashvili)
+ * That's implementation of <b>PDFTemplateBuilder </b>
+ * @see org.apache.pdfbox.pdmodel.interactive.digitalsignature.visible.PDFTemplateBuilder
+ * @author <a href="mailto:vakhtang.koroghlishvili@gmail.com"> vakhtang koroghlishvili (gogebashvili) </a>
  * 
  */
 public class PDVisibleSigBuilder implements PDFTemplateBuilder
@@ -52,7 +53,6 @@ public class PDVisibleSigBuilder impleme
     private PDFTemplateStructure pdfStructure;
     private static final Log logger = LogFactory.getLog(PDVisibleSigBuilder.class);
 
-    @Override
     public void createPage(PDVisibleSignDesigner properties)
     {
         PDPage page = new PDPage();
@@ -61,7 +61,6 @@ public class PDVisibleSigBuilder impleme
         logger.info("PDF page has been created");
     }
 
-    @Override
     public void createTemplate(PDPage page) throws IOException
     {
         PDDocument template = new PDDocument();
@@ -76,7 +75,6 @@ public class PDVisibleSigBuilder impleme
 
     }
 
-    @Override
     public void createAcroForm(PDDocument template)
     {
         PDAcroForm theAcroForm = new PDAcroForm(template);
@@ -86,13 +84,11 @@ public class PDVisibleSigBuilder impleme
 
     }
 
-    @Override
     public PDFTemplateStructure getStructure()
     {
         return pdfStructure;
     }
 
-    @Override
     public void createSignatureField(PDAcroForm acroForm) throws IOException
     {
         PDSignatureField sf = new PDSignatureField(acroForm);
@@ -100,7 +96,6 @@ public class PDVisibleSigBuilder impleme
         logger.info("Signature field has been created");
     }
 
-    @Override
     public void createSignature(PDSignatureField pdSignatureField, PDPage page, String signatureName)
             throws IOException
     {
@@ -115,7 +110,6 @@ public class PDVisibleSigBuilder impleme
         logger.info("PDSignatur has been created");
     }
 
-    @Override
     public void createAcroFormDictionary(PDAcroForm acroForm, PDSignatureField signatureField) throws IOException
     {
         @SuppressWarnings("unchecked")
@@ -130,7 +124,6 @@ public class PDVisibleSigBuilder impleme
         logger.info("AcroForm dictionary has been created");
     }
 
-    @Override
     public void createSignatureRectangle(PDSignatureField signatureField, PDVisibleSignDesigner properties)
             throws IOException
     {
@@ -145,7 +138,6 @@ public class PDVisibleSigBuilder impleme
         logger.info("rectangle of signature has been created");
     }
 
-    @Override
     public void createAffineTransform(byte[] params)
     {
         AffineTransform transform = new AffineTransform(params[0], params[1], params[2], params[3], params[4],
@@ -154,7 +146,6 @@ public class PDVisibleSigBuilder impleme
         logger.info("Matrix has been added");
     }
 
-    @Override
     public void createProcSetArray()
     {
         COSArray procSetArr = new COSArray();
@@ -167,7 +158,6 @@ public class PDVisibleSigBuilder impleme
         logger.info("ProcSet array has been created");
     }
 
-    @Override
     public void createSignatureImage(PDDocument template, InputStream inputStream) throws IOException
     {
         PDJpeg img = new PDJpeg(template, inputStream);
@@ -178,7 +168,6 @@ public class PDVisibleSigBuilder impleme
 
     }
 
-    @Override
     public void createFormaterRectangle(byte[] params)
     {
 
@@ -193,7 +182,6 @@ public class PDVisibleSigBuilder impleme
 
     }
 
-    @Override
     public void createHolderFormStream(PDDocument template)
     {
         PDStream holderForm = new PDStream(template);
@@ -201,7 +189,6 @@ public class PDVisibleSigBuilder impleme
         logger.info("Holder form Stream has been created");
     }
 
-    @Override
     public void createHolderFormResources()
     {
         PDResources holderFormResources = new PDResources();
@@ -210,7 +197,6 @@ public class PDVisibleSigBuilder impleme
 
     }
 
-    @Override
     public void createHolderForm(PDResources holderFormResources, PDStream holderFormStream, PDRectangle formrect)
     {
 
@@ -223,7 +209,6 @@ public class PDVisibleSigBuilder impleme
 
     }
 
-    @Override
     public void createAppearanceDictionary(PDXObjectForm holderForml, PDSignatureField signatureField)
             throws IOException
     {
@@ -241,7 +226,6 @@ public class PDVisibleSigBuilder impleme
 
     }
 
-    @Override
     public void createInnerFormStream(PDDocument template)
     {
         PDStream innterFormStream = new PDStream(template);
@@ -249,7 +233,6 @@ public class PDVisibleSigBuilder impleme
         logger.info("Strean of another form (inner form - it would be inside holder form) has been created");
     }
 
-    @Override
     public void createInnerFormResource()
     {
         PDResources innerFormResources = new PDResources();
@@ -257,7 +240,6 @@ public class PDVisibleSigBuilder impleme
         logger.info("Resources of another form (inner form - it would be inside holder form) have been created");
     }
 
-    @Override
     public void createInnerForm(PDResources innerFormResources, PDStream innerFormStream, PDRectangle formrect)
     {
         PDXObjectForm innerForm = new PDXObjectForm(innerFormStream);
@@ -269,7 +251,6 @@ public class PDVisibleSigBuilder impleme
 
     }
 
-    @Override
     public void insertInnerFormToHolerResources(PDXObjectForm innerForm, PDResources holderFormResources)
     {
         String name = holderFormResources.addXObject(innerForm, "FRM");
@@ -277,7 +258,6 @@ public class PDVisibleSigBuilder impleme
         logger.info("Alerady inserted inner form  inside holder form");
     }
 
-    @Override
     public void createImageFormStream(PDDocument template)
     {
         PDStream imageFormStream = new PDStream(template);
@@ -286,7 +266,6 @@ public class PDVisibleSigBuilder impleme
 
     }
 
-    @Override
     public void createImageFormResources()
     {
         PDResources imageFormResources = new PDResources();
@@ -294,7 +273,6 @@ public class PDVisibleSigBuilder impleme
         logger.info("Created image form Resources");
     }
 
-    @Override
     public void createImageForm(PDResources imageFormResources, PDResources innerFormResource,
             PDStream imageFormStream, PDRectangle formrect, AffineTransform affineTransform, PDJpeg img)
             throws IOException
@@ -327,7 +305,6 @@ public class PDVisibleSigBuilder impleme
         logger.info("Created image form");
     }
 
-    @Override
     public void injectProcSetArray(PDXObjectForm innerForm, PDPage page, PDResources innerFormResources,
             PDResources imageFormResources, PDResources holderFormResources, COSArray procSet)
     {
@@ -340,7 +317,6 @@ public class PDVisibleSigBuilder impleme
         logger.info("inserted ProcSet to PDF");
     }
 
-    @Override
     public void injectAppearanceStreams(PDStream holderFormStream, PDStream innterFormStream, PDStream imageFormStream,
             String imageObjectName, String imageName, String innerFormName, PDVisibleSignDesigner properties)
             throws IOException
@@ -367,7 +343,6 @@ public class PDVisibleSigBuilder impleme
         os.close();
     }
 
-    @Override
     public void createVisualSignature(PDDocument template)
     {
         this.pdfStructure.setVisualSignature(template.getDocument());
@@ -375,7 +350,6 @@ public class PDVisibleSigBuilder impleme
 
     }
 
-    @Override
     public void createWidgetDictionary(PDSignatureField signatureField, PDResources holderFormResources)
             throws IOException
     {
@@ -388,7 +362,6 @@ public class PDVisibleSigBuilder impleme
         logger.info("WidgetDictionary has been crated");
     }
 
-    @Override
     public void closeTemplate(PDDocument template) throws IOException
     {
         template.close();

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigProperties.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigProperties.java?rev=1542748&r1=1541625&r2=1542748&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigProperties.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigProperties.java Sun Nov 17 15:27:33 2013
@@ -16,17 +16,13 @@
  */
 package org.apache.pdfbox.pdmodel.interactive.digitalsignature.visible;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
-import org.apache.pdfbox.cos.COSDictionary;
-import org.apache.pdfbox.cos.COSDocument;
-
 /**
  * This builder class is in order to create visible signature properties.
  * 
- * @author Vakhtang koroghlishvili (Gogebashvili)
+ * @author <a href="mailto:vakhtang.koroghlishvili@gmail.com"> vakhtang koroghlishvili (gogebashvili) </a>
  * 
  */
 public class PDVisibleSigProperties
@@ -63,7 +59,7 @@ public class PDVisibleSigProperties
     }
 
     /**
-     * sets signer name
+     * Sets signer name
      * @param signerName
      * @return
      */
@@ -74,7 +70,7 @@ public class PDVisibleSigProperties
     }
 
     /**
-     * 
+     * Gets signer locations
      * @return - location
      */
     public String getSignerLocation()

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSignDesigner.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSignDesigner.java?rev=1542748&r1=1541625&r2=1542748&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSignDesigner.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSignDesigner.java Sun Nov 17 15:27:33 2013
@@ -37,7 +37,7 @@ import org.bouncycastle.util.Arrays;
  * visible signature design. Because of 
  * this is builder, instead of setParam()
  * we use param() methods.
- * @author Vakhtang koroghlishvili (Gogebashvili) 
+ * @author <a href="mailto:vakhtang.koroghlishvili@gmail.com"> vakhtang koroghlishvili (gogebashvili) </a>
  */
 public class PDVisibleSignDesigner
 {
@@ -73,8 +73,8 @@ public class PDVisibleSignDesigner
 
     /**
      * 
-     * @param documentPath
-     * @param imageStream
+     * @param documentPath - path of your pdf document
+     * @param imageStream - stream of image
      * @param page -which page are you going to add visible signature
      * @throws IOException
      */
@@ -93,7 +93,14 @@ public class PDVisibleSignDesigner
         document.close();
     }
 
-    public PDVisibleSignDesigner(PDDocument doc, InputStream imageStream, int page) throws IOException
+    /**
+     * 
+     * @param doc - Already created PDDocument of your PDF document
+     * @param imageStream
+     * @param page
+     * @throws IOException - If we can't read, flush, or can't close stream
+     */
+    public PDVisibleSignDesigner(PDDocument doc, InputStream imageStream, int page) throws IOException 
     {
         signatureImageStream(imageStream);
         calculatePageSize(doc, page);
@@ -298,15 +305,15 @@ public class PDVisibleSignDesigner
      * 
      * @param imgageStream- stream of your visible signature image
      * @return Visible Signature Configuration Object
-     * @throws IOException
+     * @throws IOException - If we can't read, flush, or close stream of image
      */
-    private PDVisibleSignDesigner signatureImageStream(InputStream imgageStream) throws IOException
+    private PDVisibleSignDesigner signatureImageStream(InputStream imageStream) throws IOException 
     {
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         byte[] buffer = new byte[1024];
         int len;
-        while ((len = imgageStream.read(buffer)) > -1)
+        while ((len = imageStream.read(buffer)) > -1)
         {
             baos.write(buffer, 0, len);
         }
@@ -333,9 +340,9 @@ public class PDVisibleSignDesigner
      * calculates image width and height. sported formats: all
      * 
      * @param fis - input stream of image
-     * @throws IOException
+     * @throws IOException - if can't read input stream
      */
-    private void calcualteImageSize(InputStream fis) throws IOException
+    private void calcualteImageSize(InputStream fis) throws IOException 
     {
 
         BufferedImage bimg = ImageIO.read(fis);