本文整理匯總了C#中iTextSharp.text.pdf.PdfRectangle.Add方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfRectangle.Add方法的具體用法?C# PdfRectangle.Add怎麽用?C# PdfRectangle.Add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfRectangle
的用法示例。
在下文中一共展示了PdfRectangle.Add方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: RotateAnnotations
public PdfArray RotateAnnotations(PdfWriter writer, Rectangle pageSize) {
PdfArray array = new PdfArray();
int rotation = pageSize.Rotation % 360;
int currentPage = writer.CurrentPageNumber;
for (int k = 0; k < annotations.Count; ++k) {
PdfAnnotation dic = annotations[k];
int page = dic.PlaceInPage;
if (page > currentPage) {
delayedAnnotations.Add(dic);
continue;
}
if (dic.IsForm()) {
if (!dic.IsUsed()) {
Dictionary<PdfTemplate,object> templates = dic.Templates;
if (templates != null)
acroForm.AddFieldTemplates(templates);
}
PdfFormField field = (PdfFormField)dic;
if (field.Parent == null)
acroForm.AddDocumentField(field.IndirectReference);
}
if (dic.IsAnnotation()) {
array.Add(dic.IndirectReference);
if (!dic.IsUsed()) {
PdfArray tmp = dic.GetAsArray(PdfName.RECT);
PdfRectangle rect = new PdfRectangle(tmp.GetAsNumber(0).FloatValue, tmp.GetAsNumber(1).FloatValue);
if (tmp.Size == 4)
{
rect.Add(tmp.GetAsNumber(2));
rect.Add(tmp.GetAsNumber(3));
}
if (rect != null) {
switch (rotation) {
case 90:
dic.Put(PdfName.RECT, new PdfRectangle(
pageSize.Top - rect.Bottom,
rect.Left,
pageSize.Top - rect.Top,
rect.Right));
break;
case 180:
dic.Put(PdfName.RECT, new PdfRectangle(
pageSize.Right - rect.Left,
pageSize.Top - rect.Bottom,
pageSize.Right - rect.Right,
pageSize.Top - rect.Top));
break;
case 270:
dic.Put(PdfName.RECT, new PdfRectangle(
rect.Bottom,
pageSize.Right - rect.Left,
rect.Top,
pageSize.Right - rect.Right));
break;
}
}
}
}
if (!dic.IsUsed()) {
dic.SetUsed();
writer.AddToBody(dic, dic.IndirectReference);
}
}
return array;
}