本文整理汇总了C#中iTextSharp.text.pdf.PdfObject.IsString方法的典型用法代码示例。如果您正苦于以下问题:C# PdfObject.IsString方法的具体用法?C# PdfObject.IsString怎么用?C# PdfObject.IsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp.text.pdf.PdfObject
的用法示例。
在下文中一共展示了PdfObject.IsString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例4: 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);
}
}
示例5: 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());
}