本文整理汇总了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);
}