本文整理匯總了C#中iTextSharp.text.pdf.PdfObject.IsArray方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfObject.IsArray方法的具體用法?C# PdfObject.IsArray怎麽用?C# PdfObject.IsArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfObject
的用法示例。
在下文中一共展示了PdfObject.IsArray方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: VerifyArraySize
private PdfArray VerifyArraySize(PdfObject obj, int size, String message) {
if (obj == null || !obj.IsArray()) Assert.Fail(message + " is not array");
if (((PdfArray) obj).Size != size)
Assert.Fail(message + " has wrong size");
return (PdfArray) obj;
}
示例2: MapGotoBookmark
private static void MapGotoBookmark(Dictionary<String, Object> map, PdfObject dest, IntHashtable pages)
{
if (dest.IsString())
map["Named"] = dest.ToString();
else if (dest.IsName())
map["Named"] = PdfName.DecodeName(dest.ToString());
else if (dest.IsArray())
map["Page"] = MakeBookmarkParam((PdfArray)dest, pages); //changed by ujihara 2004-06-13
map["Action"] = "GoTo";
}
示例3: SerObject
private void SerObject(PdfObject obj, int level, ByteBuffer bb)
{
if (level <= 0)
return;
if (obj == null) {
bb.Append("$Lnull");
return;
}
obj = PdfReader.GetPdfObject(obj);
if (obj.IsStream()) {
bb.Append("$B");
SerDic((PdfDictionary)obj, level - 1, bb);
if (level > 0) {
bb.Append(PdfEncryption.DigestComputeHash("MD5", PdfReader.GetStreamBytesRaw((PRStream)obj)));
}
}
else if (obj.IsDictionary()) {
SerDic((PdfDictionary)obj, level - 1, bb);
}
else if (obj.IsArray()) {
SerArray((PdfArray)obj, level - 1, bb);
}
else if (obj.IsString()) {
bb.Append("$S").Append(obj.ToString());
}
else if (obj.IsName()) {
bb.Append("$N").Append(obj.ToString());
}
else
bb.Append("$L").Append(obj.ToString());
}
示例4: AddClass
internal void AddClass(PdfObject obj) {
obj = GetDirectObject(obj);
if (obj.IsDictionary()) {
PdfObject curClass = ((PdfDictionary)obj).Get(PdfName.C);
if (curClass == null)
return;
if (curClass.IsArray()) {
PdfArray array = (PdfArray)curClass;
for (int i = 0; i < array.Size; ++i) {
AddClass(array[i]);
}
} else if (curClass.IsName())
AddClass(curClass);
} else if (obj.IsName()) {
PdfName name = (PdfName)obj;
if (sourceClassMap == null) {
obj = GetDirectObject(structTreeRoot.Get(PdfName.CLASSMAP));
if (obj == null || !obj.IsDictionary()) {
return;
}
sourceClassMap = (PdfDictionary)obj;
}
obj = GetDirectObject(sourceClassMap.Get(name));
if (obj == null) {
return;
}
PdfObject put = structureTreeRoot.GetMappedClass(name);
if (put != null) {
if (!CompareObjects(put,obj)) {
throw new BadPdfFormatException(MessageLocalization.GetComposedMessage("conflict.in.classmap",name));
}
} else {
if (obj.IsDictionary())
structureTreeRoot.MapClass(name, GetDirectDict((PdfDictionary)obj));
else if (obj.IsArray()) {
structureTreeRoot.MapClass(name, GetDirectArray((PdfArray)obj));
}
}
}
}
示例5: SerObject
private void SerObject(PdfObject obj, int level, ByteBuffer bb, Dictionary<RefKey, int> serialized)
{
if (level <= 0)
return;
if (obj == null) {
bb.Append("$Lnull");
return;
}
PdfIndirectReference refe = null;
ByteBuffer savedBb = null;
if (obj.IsIndirect()) {
refe = (PdfIndirectReference)obj;
RefKey key = new RefKey(refe);
if (serialized.ContainsKey(key)) {
bb.Append(serialized[key]);
return;
}
else {
savedBb = bb;
bb = new ByteBuffer();
}
}
obj = PdfReader.GetPdfObject(obj);
if (obj.IsStream()) {
bb.Append("$B");
SerDic((PdfDictionary)obj, level - 1, bb, serialized);
if (level > 0) {
bb.Append(DigestAlgorithms.Digest("MD5", PdfReader.GetStreamBytesRaw((PRStream)obj)));
}
}
else if (obj.IsDictionary()) {
SerDic((PdfDictionary)obj, level - 1, bb,serialized);
}
else if (obj.IsArray()) {
SerArray((PdfArray)obj, level - 1, bb,serialized);
}
else if (obj.IsString()) {
bb.Append("$S").Append(obj.ToString());
}
else if (obj.IsName()) {
bb.Append("$N").Append(obj.ToString());
}
else
bb.Append("$L").Append(obj.ToString());
if (savedBb != null) {
RefKey key = new RefKey(refe);
if (!serialized.ContainsKey(key))
serialized[key] = CalculateHash(bb.Buffer);
savedBb.Append(bb);
}
}
示例6: GetNameArray
private static PdfArray GetNameArray(PdfObject obj) {
if (obj == null)
return null;
obj = GetPdfObjectRelease(obj);
if (obj == null)
return null;
if (obj.IsArray())
return (PdfArray)obj;
else if (obj.IsDictionary()) {
PdfObject arr2 = GetPdfObjectRelease(((PdfDictionary)obj).Get(PdfName.D));
if (arr2 != null && arr2.IsArray())
return (PdfArray)arr2;
}
return null;
}
示例7: CompareObjects
public static bool CompareObjects(PdfObject value1, PdfObject value2) {
value2 = GetDirectObject(value2);
if (value2 == null)
return false;
if (value1.Type != value2.Type)
return false;
if (value1.IsBoolean()){
if (value1 == value2)
return true;
if (value2 is PdfBoolean) {
return ((PdfBoolean)value1).BooleanValue == ((PdfBoolean)value2).BooleanValue;
}
return false;
} else if (value1.IsName()) {
return value1.Equals(value2);
} else if (value1.IsNumber()){
if (value1 == value2)
return true;
if (value2 is PdfNumber) {
return ((PdfNumber)value1).DoubleValue == ((PdfNumber)value2).DoubleValue;
}
return false;
} else if (value1.IsNull()){
if (value1 == value2)
return true;
if (value2 is PdfNull)
return true;
return false;
} else if (value1.IsString()){
if (value1 == value2)
return true;
if (value2 is PdfString) {
return ((value2 == null && value1.ToString() == null)
|| value1.ToString() == value2.ToString());
}
return false;
}
if (value1.IsArray()) {
PdfArray array1 = (PdfArray)value1;
PdfArray array2 = (PdfArray)value2;
if (array1.Size != array2.Size)
return false;
for (int i = 0; i < array1.Size; ++i)
if (!CompareObjects(array1[i],array2[i]))
return false;
return true;
}
if (value1.IsDictionary()) {
PdfDictionary first = (PdfDictionary)value1;
PdfDictionary second = (PdfDictionary)value2;
if (first.Size != second.Size)
return false;
foreach (PdfName name in first.hashMap.Keys) {
if (!CompareObjects(first.Get(name),second.Get(name)))
return false;
}
return true;
}
return false;
}
示例8: UpdateReferences
private void UpdateReferences(PdfObject obj) {
if (obj.IsDictionary() || obj.IsStream()) {
PdfDictionary dictionary = (PdfDictionary)obj;
PdfDictionary newDictionary = new PdfDictionary();
foreach (PdfName key in dictionary.Keys) {
PdfObject o = dictionary.Get(key);
if (o.IsIndirect()) {
PdfReader reader = ((PRIndirectReference)o).Reader;
Dictionary<RefKey,IndirectReferences> indirects = indirectMap[reader];
IndirectReferences indRef = null;
if (indirects.TryGetValue(new RefKey((PRIndirectReference)o), out indRef)) {
newDictionary.Put(key, indRef.Ref);
}
} else {
UpdateReferences(o);
}
}
foreach (PdfName key in newDictionary.Keys) {
dictionary.Put(key, newDictionary.Get(key));
}
} else if (obj.IsArray()) {
PdfArray array = (PdfArray)obj;
for (int i = 0; i < array.Size; i++) {
PdfObject o = array[i];
if (o.IsIndirect()) {
PdfReader reader = ((PRIndirectReference)o).Reader;
Dictionary<RefKey,IndirectReferences> indirects = indirectMap[reader];
IndirectReferences indRef = null;
if (indirects.TryGetValue(new RefKey((PRIndirectReference)o), out indRef)) {
array[i] = indRef.Ref;
}
} else {
UpdateReferences(o);
}
}
}
}
示例9: AddToBody
public new PdfIndirectObject AddToBody(PdfObject objecta, PdfIndirectReference refa, bool formBranching) {
if (formBranching) {
UpdateReferences(objecta);
}
PdfIndirectObject indObj;
if ((tagged || mergeFields) && indirectObjects != null && (objecta.IsArray() || objecta.IsDictionary() || objecta.IsStream())) {
RefKey key = new RefKey(refa);
PdfIndirectObject obj;
if (!indirectObjects.TryGetValue(key, out obj)) {
obj = new PdfIndirectObject(refa, objecta, this);
indirectObjects[key] = obj;
}
indObj = obj;
} else {
indObj = base.AddToBody(objecta, refa);
}
if (mergeFields && objecta.IsDictionary()) {
PdfNumber annotId = ((PdfDictionary)objecta).GetAsNumber(PdfCopy.annotId);
if (annotId != null) {
if (formBranching) {
mergedMap[annotId.IntValue] = indObj;
mergedSet.Add(indObj);
} else {
unmergedMap[annotId.IntValue] = indObj;
unmergedSet.Add(indObj);
}
}
}
return indObj;
}
示例10: UpdateAnnotationReferences
private void UpdateAnnotationReferences(PdfObject obj) {
if (obj.IsArray()) {
PdfArray array = (PdfArray)obj;
for (int i = 0; i < array.Size; i++) {
PdfObject o = array[i];
if (o is PdfIndirectReference) {
foreach (PdfIndirectObject entry in unmergedSet) {
if (entry.IndirectReference.ToString().Equals(o.ToString())) {
if (entry.objecti.IsDictionary()) {
PdfNumber annotId = ((PdfDictionary)entry.objecti).GetAsNumber(PdfCopy.annotId);
if (annotId != null) {
PdfIndirectObject merged = null;
if (mergedMap.TryGetValue(annotId.IntValue, out merged)) {
array[i] = merged.IndirectReference;
}
}
}
}
}
} else {
UpdateAnnotationReferences(o);
}
}
} else if (obj.IsDictionary() || obj.IsStream()) {
PdfDictionary dictionary = (PdfDictionary)obj;
PdfDictionary newDictionary = new PdfDictionary();
foreach (PdfName key in dictionary.Keys) {
PdfObject o = dictionary.Get(key);
if (o is PdfIndirectReference) {
foreach (PdfIndirectObject entry in unmergedSet) {
if (entry.IndirectReference.ToString().Equals(o.ToString())) {
if (entry.objecti.IsDictionary()) {
PdfNumber annotId = ((PdfDictionary)entry.objecti).GetAsNumber(PdfCopy.annotId);
if (annotId != null) {
PdfIndirectObject merged;
if (mergedMap.TryGetValue(annotId.IntValue, out merged)) {
newDictionary.Put(key, merged.IndirectReference);
}
}
}
}
}
} else {
UpdateAnnotationReferences(o);
}
}
foreach (PdfName key in newDictionary.Keys) {
dictionary.Put(key, newDictionary.Get(key));
}
}
}
示例11: Propagate
private PdfObject Propagate(PdfObject obj) {
if (obj == null) {
return new PdfNull();
}
if (obj.IsArray()) {
PdfArray a = (PdfArray)obj;
for (int i = 0; i < a.Size; i++) {
a[i] = Propagate(a[i]);
}
return a;
}
if (obj.IsDictionary() || obj.IsStream()) {
PdfDictionary d = (PdfDictionary)obj;
PdfDictionary newD = new PdfDictionary();
foreach (PdfName key in d.Keys) {
newD.Put(key, Propagate(d.Get(key)));
}
return newD;
}
if (obj.IsIndirect()) {
obj = PdfReader.GetPdfObject(obj);
return AddToBody(Propagate(obj)).IndirectReference;
}
return obj;
}
示例12: SerObject
private void SerObject(PdfObject obj, int level, ByteBuffer bb) {
if (level <= 0)
return;
if (obj == null) {
bb.Append("$Lnull");
return;
}
if (obj.IsIndirect()) {
if (serialized.Contains(obj))
return;
else
serialized.Add(obj);
}
obj = PdfReader.GetPdfObject(obj);
if (obj.IsStream()) {
bb.Append("$B");
SerDic((PdfDictionary)obj, level - 1, bb);
if (level > 0) {
bb.Append(DigestAlgorithms.Digest("MD5", PdfReader.GetStreamBytesRaw((PRStream)obj)));
}
}
else if (obj.IsDictionary()) {
SerDic((PdfDictionary)obj, level - 1, bb);
}
else if (obj.IsArray()) {
SerArray((PdfArray)obj, level - 1, bb);
}
else if (obj.IsString()) {
bb.Append("$S").Append(obj.ToString());
}
else if (obj.IsName()) {
bb.Append("$N").Append(obj.ToString());
}
else
bb.Append("$L").Append(obj.ToString());
}
示例13: SimplifyColorspace
private PdfObject SimplifyColorspace(PdfObject obj)
{
if (obj == null || !obj.IsArray())
return obj;
PdfObject first = (PdfObject)(((PdfArray)obj).ArrayList[0]);
if (PdfName.CALGRAY.Equals(first))
return PdfName.DEVICEGRAY;
else if (PdfName.CALRGB.Equals(first))
return PdfName.DEVICERGB;
else
return obj;
}
示例14: Propagate
private PdfObject Propagate(PdfObject obj) {
if (obj == null) {
return new PdfNull();
} else if (obj.IsArray()) {
PdfArray a = (PdfArray)obj;
for (int i = 0; i < a.Size; i++) {
a.Set(i, Propagate(a.GetPdfObject(i)));
}
return a;
} else if (obj.IsDictionary() || obj.IsStream()) {
PdfDictionary d = (PdfDictionary)obj;
List<PdfName> keys = new List<PdfName>(d.Keys);
foreach (PdfName key in keys) {
d.Put(key, Propagate(d.Get(key)));
}
return d;
} else if (obj.IsIndirect()) {
obj = PdfReader.GetPdfObject(obj);
return AddToBody(Propagate(obj)).IndirectReference;
} else
return obj;
}
示例15: UpdateAnnotationReferences
private void UpdateAnnotationReferences(PdfObject obj) {
if (obj.IsArray()) {
PdfArray array = (PdfArray)obj;
for (int i = 0; i < array.Size; i++) {
PdfObject o = array.GetPdfObject(i);
if (o != null && o.Type == 0) {
PdfIndirectObject entry;
bool contains = unmergedIndirectRefsMap.TryGetValue(new RefKey((PdfIndirectReference) o), out entry);
if (contains) {
if (entry.objecti.IsDictionary()) {
PdfNumber annotId = ((PdfDictionary) entry.objecti).GetAsNumber(PdfCopy.annotId);
if (annotId != null) {
PdfIndirectObject merged;
if (mergedMap.TryGetValue(annotId.IntValue, out merged)) {
array.Set(i, merged.IndirectReference);
}
}
}
}
} else {
UpdateAnnotationReferences(o);
}
}
} else if (obj.IsDictionary() || obj.IsStream()) {
PdfDictionary dictionary = (PdfDictionary)obj;
List<PdfName> keys = new List<PdfName>(dictionary.Keys);
foreach (PdfName key in keys) {
PdfObject o = dictionary.Get(key);
if (o != null && o.Type == 0) {
PdfIndirectObject entry;
bool contains = unmergedIndirectRefsMap.TryGetValue(new RefKey((PdfIndirectReference) o), out entry);
if (contains) {
if (entry.objecti.IsDictionary()) {
PdfNumber annotId = ((PdfDictionary) entry.objecti).GetAsNumber(PdfCopy.annotId);
if (annotId != null) {
PdfIndirectObject merged;
if (mergedMap.TryGetValue(annotId.IntValue, out merged)) {
dictionary.Put(key, merged.IndirectReference);
}
}
}
}
} else {
UpdateAnnotationReferences(o);
}
}
}
}