AddAnnotation() public méthode

public AddAnnotation ( PdfAnnotation annot ) : void
annot PdfAnnotation
Résultat void
 /**
  * @see com.itextpdf.text.pdf.PdfPageEventHelper#onGenericTag(
  *      com.itextpdf.text.pdf.PdfWriter,
  *      com.itextpdf.text.Document,
  *      com.itextpdf.text.Rectangle, java.lang.String)
  */
 public override void OnGenericTag(PdfWriter writer,
   Document document, Rectangle rect, string text)
 {
     PdfAnnotation annotation = new PdfAnnotation(writer,
       new Rectangle(
         rect.Right + 10, rect.Bottom,
         rect.Right + 30, rect.Top
       )
     );
     annotation.Title = "Text annotation";
     annotation.Put(PdfName.SUBTYPE, PdfName.TEXT);
     annotation.Put(PdfName.OPEN, PdfBoolean.PDFFALSE);
     annotation.Put(PdfName.CONTENTS,
       new PdfString(string.Format("Icon: {0}", text))
     );
     annotation.Put(PdfName.NAME, new PdfName(text));
     writer.AddAnnotation(annotation);
 }
 /**
 * @see com.lowagie.text.pdf.PdfPageEvent#onGenericTag(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document, com.lowagie.text.Rectangle, java.lang.String)
 */
 public override void OnGenericTag(PdfWriter writer, Document document,
         Rectangle rect, String text) {
     rect.Bottom = rect.Bottom - 3;
     PdfFormField field;
     genericChunkFields.TryGetValue(text, out field);
     if (field == null) {
         TextField tf = new TextField(writer, new Rectangle(rect.GetLeft(padding), rect.GetBottom(padding), rect.GetRight(padding), rect.GetTop(padding)), text);
         tf.FontSize = 14;
         field = tf.GetTextField();
     }
     else {
         field.Put(PdfName.RECT,  new PdfRectangle(rect.GetLeft(padding), rect.GetBottom(padding), rect.GetRight(padding), rect.GetTop(padding)));
     }
     if (parent == null)
         writer.AddAnnotation(field);
     else
         parent.AddKid(field);
 }
 // ---------------------------------------------------------------------------    
 /**
  * Create a pushbutton for a key
  * @param writer the PdfWriter
  * @param rect the position of the key
  * @param btn the label for the key
  * @param script the script to be executed when the button is pushed
  */
 public void AddPushButton(PdfWriter writer, Rectangle rect,
   String btn, String script)
 {
     float w = rect.Width;
     float h = rect.Height;
     PdfFormField pushbutton = PdfFormField.CreatePushButton(writer);
     pushbutton.FieldName = "btn_" + btn;
     pushbutton.SetWidget(rect, PdfAnnotation.HIGHLIGHT_PUSH);
     PdfContentByte cb = writer.DirectContent;
     pushbutton.SetAppearance(
       PdfAnnotation.APPEARANCE_NORMAL,
       CreateAppearance(cb, btn, BaseColor.GRAY, w, h)
     );
     pushbutton.SetAppearance(
       PdfAnnotation.APPEARANCE_ROLLOVER,
       CreateAppearance(cb, btn, BaseColor.RED, w, h)
     );
     pushbutton.SetAppearance(
       PdfAnnotation.APPEARANCE_DOWN,
       CreateAppearance(cb, btn, BaseColor.BLUE, w, h)
     );
     pushbutton.SetAdditionalActions(
       PdfName.U,
       PdfAction.JavaScript(script, writer)
     );
     pushbutton.SetAdditionalActions(
       PdfName.E, PdfAction.JavaScript(
         "this.showMove('" + btn + "');", writer
       )
     );
     pushbutton.SetAdditionalActions(
       PdfName.X, PdfAction.JavaScript(
         "this.showMove(' ');", writer
       )
     );
     writer.AddAnnotation(pushbutton);
 }
 // ---------------------------------------------------------------------------    
 /**
  * Add a text field.
  * @param writer the PdfWriter
  * @param rect the position of the text field
  * @param name the name of the text field
  */
 public void AddTextField(PdfWriter writer, Rectangle rect, String name)
 {
     PdfFormField field = PdfFormField.CreateTextField(
       writer, false, false, 0
     );
     field.FieldName = name;
     field.SetWidget(rect, PdfAnnotation.HIGHLIGHT_NONE);
     field.Quadding = PdfFormField.Q_RIGHT;
     field.SetFieldFlags(PdfFormField.FF_READ_ONLY);
     writer.AddAnnotation(field);
 }