本文整理匯總了C#中iTextSharp.text.pdf.PdfObject.IsName方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfObject.IsName方法的具體用法?C# PdfObject.IsName怎麽用?C# PdfObject.IsName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfObject
的用法示例。
在下文中一共展示了PdfObject.IsName方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: 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());
}
示例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, 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);
}
}
示例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: 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;
}
示例6: 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());
}