當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。