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