本文整理匯總了C#中iTextSharp.text.pdf.PdfArray.GetPdfObject方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfArray.GetPdfObject方法的具體用法?C# PdfArray.GetPdfObject怎麽用?C# PdfArray.GetPdfObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfArray
的用法示例。
在下文中一共展示了PdfArray.GetPdfObject方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetNormalizedRectangle
/** Normalizes a <CODE>Rectangle</CODE> so that llx and lly are smaller than urx and ury.
* @param box the original rectangle
* @return a normalized <CODE>Rectangle</CODE>
*/
public static Rectangle GetNormalizedRectangle(PdfArray box) {
float llx = ((PdfNumber)GetPdfObjectRelease(box.GetPdfObject(0))).FloatValue;
float lly = ((PdfNumber)GetPdfObjectRelease(box.GetPdfObject(1))).FloatValue;
float urx = ((PdfNumber)GetPdfObjectRelease(box.GetPdfObject(2))).FloatValue;
float ury = ((PdfNumber)GetPdfObjectRelease(box.GetPdfObject(3))).FloatValue;
return new Rectangle(Math.Min(llx, urx), Math.Min(lly, ury),
Math.Max(llx, urx), Math.Max(lly, ury));
}
示例2: StructureTJarray
/**
* Example.
* TJ = [(h) 3 4 (q) 7 (w) (e)]
* Result = {0:0, 1:7, 2:7, 3:0, 4:0}
*
* @return Map whose key is an ordinal number of the string in the TJ array and value
* is the position adjustment.
*/
private IDictionary<int, float> StructureTJarray(PdfArray array) {
IDictionary<int, float> structuredTJoperands = new Dictionary<int, float>();
if (array.Size == 0) {
return structuredTJoperands;
}
int previousStrNum = 0;
structuredTJoperands.Add(previousStrNum, 0f);
for (int i = 0; i < array.Size; ++i) {
PdfObject currentObj = array.GetPdfObject(i);
if (currentObj is PdfString && ((PdfString) currentObj).ToUnicodeString().Length > 0) {
++previousStrNum;
structuredTJoperands.Add(previousStrNum, 0f);
} else {
float oldOffset = structuredTJoperands[previousStrNum];
structuredTJoperands[previousStrNum] = oldOffset + ((PdfNumber) currentObj).FloatValue;
}
}
return structuredTJoperands;
}
示例3: FindAndCopyMarks
private ReturnType FindAndCopyMarks(PdfArray pages, int arrayNumber, int newArrayNumber){
if (pages.GetAsNumber(0).IntValue > arrayNumber)
return ReturnType.BELOW;
if (pages.GetAsNumber(pages.Size - 2).IntValue < arrayNumber)
return ReturnType.ABOVE;
int cur = pages.Size/4;
int begin = 0;
int curNumber;
while (true) {
curNumber = pages.GetAsNumber((begin + cur)*2).IntValue;
if (curNumber == arrayNumber) {
PdfObject obj = pages.GetPdfObject((begin + cur)*2 + 1);
PdfObject obj1 = obj;
while (obj.IsIndirect())
obj = PdfReader.GetPdfObjectRelease(obj);
//invalid Nums
if (obj.IsArray()) {
PdfObject firstNotNullKid = null;
foreach (PdfObject numObj in (PdfArray) obj) {
if (numObj.IsNull()) {
if (nullReference == null)
nullReference = writer.AddToBody(new PdfNull()).IndirectReference;
structureTreeRoot.SetPageMark(newArrayNumber, nullReference);
} else {
PdfObject res = writer.CopyObject(numObj, true, false);
if (firstNotNullKid == null)
firstNotNullKid = res;
structureTreeRoot.SetPageMark(newArrayNumber, (PdfIndirectReference) res);
}
}
AttachStructTreeRootKids(firstNotNullKid);
} else if (obj.IsDictionary()) {
PdfDictionary k = GetKDict((PdfDictionary) obj);
if (k == null)
return ReturnType.NOTFOUND;
PdfObject res = writer.CopyObject(obj1, true, false);
structureTreeRoot.SetAnnotationMark(newArrayNumber, (PdfIndirectReference) res);
} else {
return ReturnType.NOTFOUND;
}
return ReturnType.FOUND;
}
if (curNumber < arrayNumber) {
begin += cur;
cur /= 2;
if (cur == 0)
cur = 1;
if (cur + begin == pages.Size)
return ReturnType.NOTFOUND;
continue;
}
if (cur + begin == 0)
return ReturnType.BELOW;
if (cur == 0)
return ReturnType.NOTFOUND;
cur /= 2;
}
}
示例4: GetDirectArray
private static PdfArray GetDirectArray(PdfArray input) {
PdfArray output = new PdfArray();
for (int i = 0; i < input.Size; ++i) {
PdfObject value = GetDirectObject(input.GetPdfObject(i));
if (value == null)
continue;
if (value.IsArray()) {
output.Add(GetDirectArray((PdfArray)value));
} else if (value.IsDictionary()) {
output.Add(GetDirectDict((PdfDictionary)value));
} else {
output.Add(value);
}
}
return output;
}
示例5: RemoveInactiveReferences
private void RemoveInactiveReferences(PdfArray array, HashSet2<RefKey> activeKeys) {
for (int i = 0; i < array.Size; ++i) {
PdfObject obj = array.GetPdfObject(i);
if ((obj.Type == 0 && !activeKeys.Contains(new RefKey((PdfIndirectReference)obj))) ||
(obj.IsDictionary() && ContainsInactivePg((PdfDictionary)obj, activeKeys)))
array.Remove(i--);
}
}