You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by jt...@hyperreal.org on 1999/11/22 18:37:22 UTC

cvs commit: xml-fop/src/org/apache/fop/pdf PDFAction.java PDFAnnotList.java PDFFileSpec.java PDFLink.java Makefile PDFDocument.java PDFPage.java

jtauber     99/11/22 09:37:21

  Modified:    src/org/apache/fop/pdf Makefile PDFDocument.java
                        PDFPage.java
  Added:       src/org/apache/fop/pdf PDFAction.java PDFAnnotList.java
                        PDFFileSpec.java PDFLink.java
  Log:
  incorporated the PDF side of simple-link support from Arved Sandstrom, ie org.apache.fop.pdf has additional classes for producing PDF documents with links
  
  Revision  Changes    Path
  1.2       +5 -1      xml-fop/src/org/apache/fop/pdf/Makefile
  
  Index: Makefile
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/Makefile,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Makefile	1999/11/08 19:13:15	1.1
  +++ Makefile	1999/11/22 17:37:15	1.2
  @@ -5,9 +5,13 @@
   
   SUBDIRS=
   
  -SOURCES=PDFDocument.java \
  +SOURCES=PDFAction.java \
  +	PDFAnnotList.java \
  +	PDFDocument.java \
  +	PDFFileSpec.java \
   	PDFFont.java \
   	PDFInfo.java \
  +	PDFLink.java \
   	PDFObject.java \
   	PDFPage.java \
   	PDFPages.java \
  
  
  
  1.6       +32 -2     xml-fop/src/org/apache/fop/pdf/PDFDocument.java
  
  Index: PDFDocument.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFDocument.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PDFDocument.java	1999/11/22 02:32:03	1.5
  +++ PDFDocument.java	1999/11/22 17:37:16	1.6
  @@ -1,4 +1,4 @@
  -/*-- $Id: PDFDocument.java,v 1.5 1999/11/22 02:32:03 jtauber Exp $ -- 
  +/*-- $Id: PDFDocument.java,v 1.6 1999/11/22 17:37:16 jtauber Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -22,7 +22,7 @@
       Alternately, this  acknowledgment may  appear in the software itself,  if
       and wherever such third-party acknowledgments normally appear.
    
  - 4. The names "Fop" and  "Apache Software Foundation"  must not be used to
  + 4. The names "FOP" and  "Apache Software Foundation"  must not be used to
       endorse  or promote  products derived  from this  software without  prior
       written permission. For written permission, please contact
       apache@apache.org.
  @@ -48,6 +48,7 @@
    Software Foundation, please see <http://www.apache.org/>.
    
    */
  +
   /* image support modified from work of BoBoGi */
   
   package org.apache.fop.pdf;
  @@ -60,6 +61,7 @@
   import java.io.IOException;
   import java.io.PrintWriter;
   import java.util.Vector;
  +import java.awt.Rectangle;
   							   
   /**
    * class representing a PDF document. 
  @@ -103,7 +105,10 @@
       /** the /Resources object */
       protected PDFResources resources;
       
  +    /** the counter for XObject numbering */
       protected int xObjectCount = 0;
  +
  +    /** the XObjects */
       protected Vector xObjects = new Vector();
   
       /**
  @@ -211,6 +216,7 @@
        * @param contents stream object with content
        * @param pagewidth width of the page in points
        * @param pageheight height of the page in points
  +     *
        * @return the created /Page object
        */
       public PDFPage makePage(PDFResources resources,
  @@ -229,6 +235,30 @@
   	this.root.addPage(page);
   
   	return page;
  +    }
  +
  +    /**
  +     * make a link object
  +     *
  +     * @param rect the clickable rectangle
  +     * @param destination the destination file
  +     * 
  +     * @return the PDFLink object created
  +     */
  +    public PDFLink makeLink(Rectangle rect, String destination) {
  +	PDFLink link = new PDFLink(++this.objectcount, destination, rect);
  +	this.objects.addElement(link);
  +
  +	PDFFileSpec fileSpec = new PDFFileSpec(++this.objectcount,
  +					       link.destination);
  +	this.objects.addElement(fileSpec);
  +
  +	PDFAction action = new PDFAction(++this.objectcount,
  +					 fileSpec);
  +	this.objects.addElement(action);
  +	link.setAction(action);
  +
  +	return link;
       }
   
       /**
  
  
  
  1.6       +33 -13    xml-fop/src/org/apache/fop/pdf/PDFPage.java
  
  Index: PDFPage.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFPage.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PDFPage.java	1999/11/22 02:32:04	1.5
  +++ PDFPage.java	1999/11/22 17:37:17	1.6
  @@ -1,4 +1,4 @@
  -/*-- $Id: PDFPage.java,v 1.5 1999/11/22 02:32:04 jtauber Exp $ -- 
  +/*-- $Id: PDFPage.java,v 1.6 1999/11/22 17:37:17 jtauber Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -22,7 +22,7 @@
       Alternately, this  acknowledgment may  appear in the software itself,  if
       and wherever such third-party acknowledgments normally appear.
    
  - 4. The names "Fop" and  "Apache Software Foundation"  must not be used to
  + 4. The names "FOP" and  "Apache Software Foundation"  must not be used to
       endorse  or promote  products derived  from this  software without  prior
       written permission. For written permission, please contact
       apache@apache.org.
  @@ -50,10 +50,6 @@
    */
   package org.apache.fop.pdf;
   
  -// Java
  -import java.io.PrintWriter;
  -import java.util.Vector;
  -
   /**
    * class representing a /Page object.
    *
  @@ -79,6 +75,9 @@
       /** the height of the page in points */
       protected int pageheight;
   
  +    /** the list of annotation objects for this page */
  +    protected PDFAnnotList annotList;
  +
       /**
        * create a /Page object
        *
  @@ -100,6 +99,8 @@
   	this.contents = contents;
   	this.pagewidth = pagewidth;
   	this.pageheight = pageheight;
  +
  +	this.annotList = null;
       }
   
       /**
  @@ -112,17 +113,36 @@
       }
   
       /**
  +     * set this page's annotation list
  +     *
  +     * @param annotList a PDFAnnotList list of annotations
  +     */
  +    public void setAnnotList(PDFAnnotList annotList) {
  +	this.annotList = annotList;
  +    }
  +
  +    /**
        * represent this object as PDF
        *
        * @return the PDF string
        */
       public String toPDF() {
  -	String p = this.number + " " + this.generation
  -	    + " obj\n<< /Type /Page\n/Parent "
  -	    + this.parent.referencePDF() + "\n/MediaBox [ 0 0 "
  -	    + this.pagewidth + " " + this.pageheight + " ]\n/Resources "
  -	    + this.resources.referencePDF() + "\n/Contents "
  -	    + this.contents.referencePDF() + " >>\nendobj\n";
  -	return p;
  +	StringBuffer sb = new StringBuffer();
  +
  +	sb = sb.append(this.number + " " + this.generation + " obj\n" +
  +		"<< / Type /Page\n" +
  +		"/Parent " + this.parent.referencePDF() + "\n" +
  +		"/MediaBox [ 0 0 " + this.pagewidth + " " +
  +		this.pageheight + " ]\n" + 
  +		"/Resources " + this.resources.referencePDF() + "\n" + 
  +		"/Contents " + this.contents.referencePDF() + "\n");
  +	if (this.annotList != null) {
  +	    sb = sb.append("/Annots " +
  +			   this.annotList.referencePDF() + "\n");
  +	}
  +
  +	sb = sb.append(">>\nendobj\n");
  +
  +	return sb.toString();
       }
   }
  
  
  
  1.1                  xml-fop/src/org/apache/fop/pdf/PDFAction.java
  
  Index: PDFAction.java
  ===================================================================
  /*-- $Id: PDFAction.java,v 1.1 1999/11/22 17:37:16 jtauber Exp $ -- 
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
   
      Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
   
   Redistribution and use in source and binary forms, with or without modifica-
   tion, 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. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
   
   4. The names "FOP" and  "Apache Software Foundation"  must not be used to
      endorse  or promote  products derived  from this  software without  prior
      written permission. For written permission, please contact
      apache@apache.org.
   
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
   
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, 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.
   
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   James Tauber <jt...@jtauber.com>. For more  information on the Apache 
   Software Foundation, please see <http://www.apache.org/>.
   
   */
  
  package org.apache.fop.pdf;
  
  /**
   * class representing a /Action object.
   */
  public class PDFAction extends PDFObject {
  
      /** the file specification */
      protected PDFFileSpec fileSpec;
  
      /**
       * create an /Action object.
       *
       * @param number the object's number
       * @param fileSpec the fileSpec associated with the action
       */
      public PDFAction(int number, PDFFileSpec fileSpec) {
  
  	/* generic creation of object */
  	super(number);
  	
  	this.fileSpec = fileSpec;
      }
  
      /**
       * represent the object in PDF
       *
       * @return the PDF string
       */
      public String toPDF() {
  	String p = new String(this.number + " " + this.generation +
  			      " obj\n" +
  			      "<<\n/S /GoToR\n" +
  			      "/F " + fileSpec.referencePDF() + "\n" +
  			      "/D [ 0 /XYZ null null null ]" +
  			      " \n>>\nendobj\n"); 
  	return p;
      }
  
      /* example
         28 0 obj
         << 
         /S /GoToR 
         /F 29 0 R 
         /D [ 0 /XYZ -6 797 null ] 
         >> 
         endobj
      */
  }
  
  
  
  1.1                  xml-fop/src/org/apache/fop/pdf/PDFAnnotList.java
  
  Index: PDFAnnotList.java
  ===================================================================
  /*-- $Id: PDFAnnotList.java,v 1.1 1999/11/22 17:37:16 jtauber Exp $ -- 
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
   
      Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
   
   Redistribution and use in source and binary forms, with or without modifica-
   tion, 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. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
   
   4. The names "FOP" and  "Apache Software Foundation"  must not be used to
      endorse  or promote  products derived  from this  software without  prior
      written permission. For written permission, please contact
      apache@apache.org.
   
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
   
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, 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.
   
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   James Tauber <jt...@jtauber.com>. For more  information on the Apache 
   Software Foundation, please see <http://www.apache.org/>.
   
   */
  
  package org.apache.fop.pdf;
  
  // Java
  import java.util.Vector;
  
  /**
   * class representing an object which is a list of annotations.
   *
   * This PDF object is a list of references to /Annot objects. So far we
   * are dealing only with links.
   */
  public class PDFAnnotList extends PDFObject {
  
      /** the /Annot objects */
      protected Vector links = new Vector();
  
      /** the number of /Annot objects */
      protected int count = 0;
  
      /**
       * create a /Annots object.
       *
       * @param number the object's number
       */
      public PDFAnnotList(int number) {
  
  	/* generic creation of object */
  	super(number);
      }
  
      /**
       * add an /Annot object of /Subtype /Link.
       *
       * @param link the PDFLink to add.
       */
      public void addLink(PDFLink link) {
  	this.links.addElement(link);
  	this.count++;
      }
  
      /**
       * get the count of /Annot objects
       *
       * @return the number of links
       */
      public int getCount() {
  	return this.count;
      }
  
      /**
       * represent the object in PDF
       *
       * @return the PDF string
       */
      public String toPDF() {
  	StringBuffer p = new StringBuffer(this.number + " "
  					  + this.generation
  					  + " obj\n[\n"); 
  	for (int i = 0; i < this.count; i++) {
  	    p = p.append(((PDFObject)
  			  links.elementAt(i)).referencePDF() + "\n");
  	}
  	p = p.append("]\nendobj\n");
  	return p.toString();
      }
  
      /* example
         20 0 obj
         [ 
         19 0 R 
         ]
         endobj
      */
  }
  
  
  
  1.1                  xml-fop/src/org/apache/fop/pdf/PDFFileSpec.java
  
  Index: PDFFileSpec.java
  ===================================================================
  /*-- $Id: PDFFileSpec.java,v 1.1 1999/11/22 17:37:17 jtauber Exp $ -- 
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
   
      Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
   
   Redistribution and use in source and binary forms, with or without modifica-
   tion, 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. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
   
   4. The names "FOP" and  "Apache Software Foundation"  must not be used to
      endorse  or promote  products derived  from this  software without  prior
      written permission. For written permission, please contact
      apache@apache.org.
   
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
   
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, 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.
   
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   James Tauber <jt...@jtauber.com>. For more  information on the Apache 
   Software Foundation, please see <http://www.apache.org/>.
   
   */
  
  package org.apache.fop.pdf;
  
  /**
   * class representing a /FileSpec object.
   *
   */
  public class PDFFileSpec extends PDFObject {
  
      /** the filename */
      protected String filename;
  
      /**
       * create a /FileSpec object.
       *
       * @param number the object's number
       * @param filename the filename represented by this object
       */
      public PDFFileSpec(int number, String filename) {
  
  	/* generic creation of object */
  	super(number);
  	
  	this.filename = filename;
      }
  
      /**
       * represent the object in PDF
       *
       * @return the PDF string
       */
      public String toPDF() {
  	String p = new String(this.number + " " + this.generation +
  			      " obj\n<<\n/Type /FileSpec\n" +
  			      "/F (" + this.filename + ")\n" + 
  			      ">>\nendobj\n"); 
  	return p;
      }
  
      /* example
         29 0 obj
         << 
         /Type /FileSpec 
         /F (table1.pdf)
         >> 
         endobj
      */
  }
  
  
  
  1.1                  xml-fop/src/org/apache/fop/pdf/PDFLink.java
  
  Index: PDFLink.java
  ===================================================================
  /*-- $Id: PDFLink.java,v 1.1 1999/11/22 17:37:17 jtauber Exp $ -- 
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
   
      Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
   
   Redistribution and use in source and binary forms, with or without modifica-
   tion, 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. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
   
   4. The names "FOP" and  "Apache Software Foundation"  must not be used to
      endorse  or promote  products derived  from this  software without  prior
      written permission. For written permission, please contact
      apache@apache.org.
   
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
   
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, 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.
   
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   James Tauber <jt...@jtauber.com>. For more  information on the Apache 
   Software Foundation, please see <http://www.apache.org/>.
   
   */
  
  package org.apache.fop.pdf;
  
  // Java
  import java.awt.Rectangle;
  
  /**
   * class representing an /Annot object of /Subtype /Link
   */
  public class PDFLink extends PDFObject {
  
      float ulx;
      float uly;
      float brx;
      float bry;
      String destination;
      String color;
      PDFAction action;
  	
      /**
       * create objects associated with a link annotation (GoToR)
       *
       * @param number the object's number
       * @param producer the application producing the PDF
       */
      public PDFLink(int number, String destName, Rectangle r) {
  	/* generic creation of PDF object */
  	super(number);
  		
  	this.ulx = r.x;
  	this.uly = r.y;
  	this.brx = r.x + r.width;
  	this.bry = r.y - r.height;
  	this.destination = destName; // what is this for?
  	this.color = "0 0 0.7";	// just for now
  		
      }
  
      public void setAction(PDFAction action) {
  	this.action = action;
      }
  	
      /**
       * produce the PDF representation of the object
       *
       * @return the PDF
       */
      public String toPDF() {
  	String p = this.number + " " + this.generation + " obj\n" +
  	    "<< /Type /Annot\n" +
  	    "/Subtype /Link\n" +
  	    "/Rect [ " + (ulx/1000f) + " " + (uly/1000f) + " " +
  	    (brx/1000f) + " " + (bry/1000f) + " ]\n"
  	    + "/C [ " + color + " ]\n" + 
  	    "/Border [ 0 0 1 ]\n" +
  	    "/A " + action.referencePDF() + "\n" +
  	    "/H /I\n>>\nendobj\n";
  	return p;
      }
  
      /* example
         19 0 obj
         << 
         /Type /Annot 
         /Subtype /Link 
         /Rect [ 176.032 678.48412 228.73579 692.356 ] 
         /C [ 0.86491 0.03421 0.02591 ] 
         /Border [ 0 0 1 ] 
         /A 28 0 R 
         /H /I 
         >> 
         endobj
      */
  }