当前位置: 首页>>代码示例>>C#>>正文


C# Rectangle.Normalize方法代码示例

本文整理汇总了C#中iTextSharp.text.Rectangle.Normalize方法的典型用法代码示例。如果您正苦于以下问题:C# Rectangle.Normalize方法的具体用法?C# Rectangle.Normalize怎么用?C# Rectangle.Normalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在iTextSharp.text.Rectangle的用法示例。


在下文中一共展示了Rectangle.Normalize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetVisibleSignature

 /**
 * Sets the signature to be visible. An empty signature field with the same name must already exist.
 * @param fieldName the existing empty signature field name
 */
 public void SetVisibleSignature(String fieldName)
 {
     AcroFields af = writer.AcroFields;
     AcroFields.Item item = af.GetFieldItem(fieldName);
     if (item == null)
         throw new ArgumentException("The field " + fieldName + " does not exist.");
     PdfDictionary merged = (PdfDictionary)item.merged[0];
     if (!PdfName.SIG.Equals(PdfReader.GetPdfObject(merged.Get(PdfName.FT))))
         throw new ArgumentException("The field " + fieldName + " is not a signature field.");
     this.fieldName = fieldName;
     PdfArray r = (PdfArray)PdfReader.GetPdfObject(merged.Get(PdfName.RECT));
     ArrayList ar = r.ArrayList;
     float llx = ((PdfNumber)PdfReader.GetPdfObject((PdfObject)ar[0])).FloatValue;
     float lly = ((PdfNumber)PdfReader.GetPdfObject((PdfObject)ar[1])).FloatValue;
     float urx = ((PdfNumber)PdfReader.GetPdfObject((PdfObject)ar[2])).FloatValue;
     float ury = ((PdfNumber)PdfReader.GetPdfObject((PdfObject)ar[3])).FloatValue;
     pageRect = new Rectangle(llx, lly, urx, ury);
     pageRect.Normalize();
     page = (int)item.page[0];
     int rotation = writer.reader.GetPageRotation(page);
     Rectangle pageSize = writer.reader.GetPageSizeWithRotation(page);
     switch (rotation) {
         case 90:
             pageRect = new Rectangle(
             pageRect.Bottom,
             pageSize.Top - pageRect.Left,
             pageRect.Top,
             pageSize.Top - pageRect.Right);
             break;
         case 180:
             pageRect = new Rectangle(
             pageSize.Right - pageRect.Left,
             pageSize.Top - pageRect.Bottom,
             pageSize.Right - pageRect.Right,
             pageSize.Top - pageRect.Top);
             break;
         case 270:
             pageRect = new Rectangle(
             pageSize.Right - pageRect.Bottom,
             pageRect.Left,
             pageSize.Right - pageRect.Top,
             pageRect.Right);
             break;
     }
     if (rotation != 0)
         pageRect.Normalize();
     rect = new Rectangle(this.pageRect.Width, this.pageRect.Height);
 }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:52,代码来源:PdfSignatureAppearance.cs


注:本文中的iTextSharp.text.Rectangle.Normalize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。