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


C# PdfAnnotation.IsForm方法代碼示例

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


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

示例1: AddAnnotation

 internal void AddAnnotation(PdfAnnotation annot, PdfDictionary pageN) {
     List<PdfAnnotation> allAnnots = new List<PdfAnnotation>();
     if (annot.IsForm()) {
         fieldsAdded = true;
         GetAcroFields();
         PdfFormField field = (PdfFormField)annot;
         if (field.Parent != null)
             return;
         ExpandFields(field, allAnnots);
     }
     else
         allAnnots.Add(annot);
     for (int k = 0; k < allAnnots.Count; ++k) {
         annot = allAnnots[k];
         if (annot.PlaceInPage > 0)
             pageN = reader.GetPageN(annot.PlaceInPage);
         if (annot.IsForm()) { 
             if (!annot.IsUsed()) {
                 HashSet2<PdfTemplate> templates = annot.GetTemplates();
                 if (templates != null)
                     fieldTemplates.AddAll(templates);
             }
             PdfFormField field = (PdfFormField)annot;
             if (field.Parent == null)
                 AddDocumentField(field.IndirectReference);
         }
         if (annot.IsAnnotation()) {
             PdfObject pdfobj = PdfReader.GetPdfObject(pageN.Get(PdfName.ANNOTS), pageN);
             PdfArray annots = null;
             if (pdfobj == null || !pdfobj.IsArray()) {
                 annots = new PdfArray();
                 pageN.Put(PdfName.ANNOTS, annots);
                 MarkUsed(pageN);
             }
             else 
                annots = (PdfArray)pdfobj;
             annots.Add(annot.IndirectReference);
             MarkUsed(annots);
             if (!annot.IsUsed()) {
                 PdfRectangle rect = (PdfRectangle)annot.Get(PdfName.RECT);
                 if (rect != null && (rect.Left != 0 || rect.Right != 0 || rect.Top != 0 || rect.Bottom != 0)) {
                     int rotation = reader.GetPageRotation(pageN);
                     Rectangle pageSize = reader.GetPageSizeWithRotation(pageN);
                     switch (rotation) {
                         case 90:
                             annot.Put(PdfName.RECT, new PdfRectangle(
                                 pageSize.Top - rect.Top,
                                 rect.Right,
                                 pageSize.Top - rect.Bottom,
                                 rect.Left));
                             break;
                         case 180:
                             annot.Put(PdfName.RECT, new PdfRectangle(
                                 pageSize.Right - rect.Left,
                                 pageSize.Top - rect.Bottom,
                                 pageSize.Right - rect.Right,
                                 pageSize.Top - rect.Top));
                             break;
                         case 270:
                             annot.Put(PdfName.RECT, new PdfRectangle(
                                 rect.Bottom,
                                 pageSize.Right - rect.Left,
                                 rect.Top,
                                 pageSize.Right - rect.Right));
                             break;
                     }
                 }
             }
         }
         if (!annot.IsUsed()) {
             annot.SetUsed();
             AddToBody(annot, annot.IndirectReference);
         }
     }
 }
開發者ID:yu0410aries,項目名稱:itextsharp,代碼行數:75,代碼來源:PdfStamperImp.cs

示例2: AddAnnotation

 internal void AddAnnotation(PdfAnnotation annot, PdfDictionary pageN)
 {
     ArrayList allAnnots = new ArrayList();
     if (annot.IsForm()) {
         fieldsAdded = true;
         AcroFields afdummy = AcroFields;
         PdfFormField field = (PdfFormField)annot;
         if (field.Parent != null)
             return;
         ExpandFields(field, allAnnots);
     }
     else
         allAnnots.Add(annot);
     for (int k = 0; k < allAnnots.Count; ++k) {
         annot = (PdfAnnotation)allAnnots[k];
         if (annot.PlaceInPage > 0)
             pageN = reader.GetPageN(annot.PlaceInPage);
         if (annot.IsForm()) {
             if (!annot.IsUsed()) {
                 Hashtable templates = annot.Templates;
                 if (templates != null) {
                     foreach (object tpl in templates.Keys) {
                         fieldTemplates[tpl] = null;
                     }
                 }
             }
             PdfFormField field = (PdfFormField)annot;
             if (field.Parent == null)
                 AddDocumentField(field.IndirectReference);
         }
         if (annot.IsAnnotation()) {
             PdfArray annots = (PdfArray)PdfReader.GetPdfObject(pageN.Get(PdfName.ANNOTS), pageN);
             if (annots == null) {
                 annots = new PdfArray();
                 pageN.Put(PdfName.ANNOTS, annots);
                 MarkUsed(pageN);
             }
             annots.Add(annot.IndirectReference);
             MarkUsed(annots);
             if (!annot.IsUsed()) {
                 PdfRectangle rect = (PdfRectangle)annot.Get(PdfName.RECT);
                 if (rect != null && (rect.Left != 0 || rect.Right != 0 || rect.Top != 0 || rect.Bottom != 0)) {
                     int rotation = reader.GetPageRotation(pageN);
                     Rectangle pageSize = reader.GetPageSizeWithRotation(pageN);
                     switch (rotation) {
                         case 90:
                             annot.Put(PdfName.RECT, new PdfRectangle(
                                 pageSize.Top - rect.Bottom,
                                 rect.Left,
                                 pageSize.Top - rect.Top,
                                 rect.Right));
                             break;
                         case 180:
                             annot.Put(PdfName.RECT, new PdfRectangle(
                                 pageSize.Right - rect.Left,
                                 pageSize.Top - rect.Bottom,
                                 pageSize.Right - rect.Right,
                                 pageSize.Top - rect.Top));
                             break;
                         case 270:
                             annot.Put(PdfName.RECT, new PdfRectangle(
                                 rect.Bottom,
                                 pageSize.Right - rect.Left,
                                 rect.Top,
                                 pageSize.Right - rect.Right));
                             break;
                     }
                 }
             }
         }
         if (!annot.IsUsed()) {
             annot.SetUsed();
             AddToBody(annot, annot.IndirectReference);
         }
     }
 }
開發者ID:hjgode,項目名稱:iTextSharpCF,代碼行數:76,代碼來源:PdfStamperImp.cs

示例3: AddAnnotation

 virtual public void AddAnnotation(PdfAnnotation annot) {
     if (annot.IsForm()) {
         PdfFormField field = (PdfFormField)annot;
         if (field.Parent == null)
             AddFormFieldRaw(field);
     }
     else
         annotations.Add(annot);
 }
開發者ID:,項目名稱:,代碼行數:9,代碼來源:

示例4: AddAnnotation

 public void AddAnnotation(PdfAnnotation annot)
 {
     List<PdfAnnotation> allAnnots = new List<PdfAnnotation>();
     if (annot.IsForm()) {
         PdfFormField field = (PdfFormField)annot;
         if (field.Parent != null)
             return;
         ExpandFields(field, allAnnots);
         if (cstp.fieldTemplates == null)
             cstp.fieldTemplates = new Dictionary<PdfTemplate,object>();
     }
     else
         allAnnots.Add(annot);
     for (int k = 0; k < allAnnots.Count; ++k) {
         annot = allAnnots[k];
         if (annot.IsForm()) {
             if (!annot.IsUsed()) {
                 Dictionary<PdfTemplate,object> templates = annot.Templates;
                 if (templates != null) {
                     foreach (PdfTemplate tpl in templates.Keys) {
                         cstp.fieldTemplates[tpl] = null;
                     }
                 }
             }
             PdfFormField field = (PdfFormField)annot;
             if (field.Parent == null)
                 AddDocumentField(field.IndirectReference);
         }
         if (annot.IsAnnotation()) {
             PdfObject pdfobj = PdfReader.GetPdfObject(pageN.Get(PdfName.ANNOTS), pageN);
             PdfArray annots = null;
             if (pdfobj == null || !pdfobj.IsArray()) {
                 annots = new PdfArray();
                 pageN.Put(PdfName.ANNOTS, annots);
             }
             else
                 annots = (PdfArray)pdfobj;
             annots.Add(annot.IndirectReference);
             if (!annot.IsUsed()) {
                 PdfRectangle rect = (PdfRectangle)annot.Get(PdfName.RECT);
                 if (rect != null && (rect.Left != 0 || rect.Right != 0 || rect.Top != 0 || rect.Bottom != 0)) {
                     int rotation = reader.GetPageRotation(pageN);
                     Rectangle pageSize = reader.GetPageSizeWithRotation(pageN);
                     switch (rotation) {
                         case 90:
                             annot.Put(PdfName.RECT, new PdfRectangle(
                                 pageSize.Top - rect.Bottom,
                                 rect.Left,
                                 pageSize.Top - rect.Top,
                                 rect.Right));
                             break;
                         case 180:
                             annot.Put(PdfName.RECT, new PdfRectangle(
                                 pageSize.Right - rect.Left,
                                 pageSize.Top - rect.Bottom,
                                 pageSize.Right - rect.Right,
                                 pageSize.Top - rect.Top));
                             break;
                         case 270:
                             annot.Put(PdfName.RECT, new PdfRectangle(
                                 rect.Bottom,
                                 pageSize.Right - rect.Left,
                                 rect.Top,
                                 pageSize.Right - rect.Right));
                             break;
                     }
                 }
             }
         }
         if (!annot.IsUsed()) {
             annot.SetUsed();
             cstp.AddToBody(annot, annot.IndirectReference);
         }
     }
 }
開發者ID:boecko,項目名稱:iTextSharp,代碼行數:75,代碼來源:PdfCopy.cs

示例5: ShallowDuplicate

 public static PdfAnnotation ShallowDuplicate(PdfAnnotation annot)
 {
     PdfAnnotation dup;
     if (annot.IsForm()) {
         dup = new PdfFormField(annot.writer);
         PdfFormField dupField = (PdfFormField)dup;
         PdfFormField srcField = (PdfFormField)annot;
         dupField.parent = srcField.parent;
         dupField.kids = srcField.kids;
     }
     else
         dup = new PdfAnnotation(annot.writer, null);
     dup.Merge(annot);
     dup.form = annot.form;
     dup.annotation = annot.annotation;
     dup.templates = annot.templates;
     return dup;
 }
開發者ID:HardcoreSoftware,項目名稱:iSecretary,代碼行數:18,代碼來源:PdfAnnotation.cs


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