I made a minor modification to allow you to add different types of text notes.
1. Make this change to addTextNote in PDF.as:
/**
* Lets you add a text annotation to the current page
*
* @param x Note X position
* @param y Note Y position
* @param width Note width
* @param height Note height
* @param text Text for the note
* @param style Style for the note. See the NoteStyle class for possible
options. Defaults to NoteStyle.NOTE
* @example
* This example shows how to add a note annotation in the current page :
* <div class="listing">
* <pre>
*
* myPDF.addNote (100, 75, 50, 50, "A note !");
* </pre>
* </div>
*/
public function addTextNote ( x:Number, y:Number, width:Number,
height:Number, text:String="A note !", style:String="Note" ):void
{
var rectangle:String = x*k + ' ' + (((currentPage.h-y)*k) - (height*k))
+ ' ' + ((x*k) + (width*k)) + ' ' + (currentPage.h-y)*k;
currentPage.annotations += ( '<</Type /Annot /Name /'+style+' /Border [0
0 1] /Subtype /Text /Rect [ '+rectangle+' ] /Contents ('+text+')>>' );
}
2. Create this new class org.alivepdf.annotations.NoteStyle:
package org.alivepdf.annotations
{
public final class NoteStyle
{
public static const COMMENT:String = "Comment";
public static const HELP:String = "Help";
public static const INSERT:String = "Insert";
public static const KEY:String = "Key";
public static const NOTE:String = "Note";
public static const PARAGRAPH:String = "Paragraph";
public static const UNKNOWN:String = "Unknown";
}
}
Just as a sidenote, I would have provided a real patch, but it seems like
the source is not in SVN.
Original issue reported on code.google.com by dro...@gmail.com on 2 Jul 2008 at 6:53
Original issue reported on code.google.com by
dro...@gmail.com
on 2 Jul 2008 at 6:53