當前位置: 首頁>>代碼示例>>C#>>正文


C# PdfWriter.AddAnnotation方法代碼示例

本文整理匯總了C#中iTextSharp.text.pdf.PdfWriter.AddAnnotation方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfWriter.AddAnnotation方法的具體用法?C# PdfWriter.AddAnnotation怎麽用?C# PdfWriter.AddAnnotation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在iTextSharp.text.pdf.PdfWriter的用法示例。


在下文中一共展示了PdfWriter.AddAnnotation方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnGenericTag

 /**
  * @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);
 }
開發者ID:kuujinbo,項目名稱:iTextInAction2Ed,代碼行數:24,代碼來源:GenericAnnotations.cs

示例2: OnGenericTag

 /**
 * @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);
 }
開發者ID:jagruti23,項目名稱:itextsharp,代碼行數:21,代碼來源:FieldPositioningEvents.cs

示例3: AddPushButton

 // ---------------------------------------------------------------------------    
 /**
  * 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);
 }
開發者ID:kuujinbo,項目名稱:iTextInAction2Ed,代碼行數:45,代碼來源:Calculator.cs

示例4: AddTextField

 // ---------------------------------------------------------------------------    
 /**
  * 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);
 }
開發者ID:kuujinbo,項目名稱:iTextInAction2Ed,代碼行數:18,代碼來源:Calculator.cs


注:本文中的iTextSharp.text.pdf.PdfWriter.AddAnnotation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。