本文整理匯總了C#中iTextSharp.text.pdf.PdfObject.IsNull方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfObject.IsNull方法的具體用法?C# PdfObject.IsNull怎麽用?C# PdfObject.IsNull使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfObject
的用法示例。
在下文中一共展示了PdfObject.IsNull方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SetDefaultColorspace
/**
* Sets the default colorspace that will be applied to all the document.
* The colorspace is only applied if another colorspace with the same name
* is not present in the content.
* <p>
* The colorspace is applied immediately when creating templates and at the page
* end for the main document content.
* @param key the name of the colorspace. It can be <CODE>PdfName.DEFAULTGRAY</CODE>, <CODE>PdfName.DEFAULTRGB</CODE>
* or <CODE>PdfName.DEFAULTCMYK</CODE>
* @param cs the colorspace. A <CODE>null</CODE> or <CODE>PdfNull</CODE> removes any colorspace with the same name
*/
public void SetDefaultColorspace(PdfName key, PdfObject cs) {
if (cs == null || cs.IsNull())
defaultColorspace.Remove(key);
defaultColorspace.Put(key, cs);
}
示例2: AddDefaultColor
internal void AddDefaultColor(PdfName name, PdfObject obj) {
if (obj == null || obj.IsNull())
colorDictionary.Remove(name);
else
colorDictionary.Put(name, obj);
}
示例3: Put
// methods concerning the Hashtable member value
/**
* Adds a <CODE>PdfObject</CODE> and its key to the <CODE>PdfDictionary</CODE>.
* If the value is <CODE>null</CODE> or <CODE>PdfNull</CODE> the key is deleted.
*
* @param key key of the entry (a <CODE>PdfName</CODE>)
* @param value value of the entry (a <CODE>PdfObject</CODE>)
*/
public void Put(PdfName key, PdfObject value)
{
if (value == null || value.IsNull())
hashMap.Remove(key);
else
hashMap[key] = value;
}
示例4: 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;
}
示例5: KillIndirect
/**
* Eliminates the reference to the object freeing the memory used by it and clearing
* the xref entry.
* @param obj the object. If it's an indirect reference it will be eliminated
* @return the object or the already erased dereferenced object
*/
public static PdfObject KillIndirect(PdfObject obj) {
if (obj == null || obj.IsNull())
return null;
PdfObject ret = GetPdfObjectRelease(obj);
if (obj.IsIndirect()) {
PRIndirectReference refi = (PRIndirectReference)obj;
PdfReader reader = refi.Reader;
int n = refi.Number;
reader.xrefObj[n] = null;
if (reader.partial)
reader.xref[n * 2] = -1;
}
return ret;
}
示例6: AddToBody
public override PdfIndirectObject AddToBody(PdfObject objecta, PdfIndirectReference refa, bool formBranching) {
if (formBranching) {
UpdateReferences(objecta);
}
PdfIndirectObject iobj;
if ((tagged || mergeFields) && indirectObjects != null && (objecta.IsArray() || objecta.IsDictionary() || objecta.IsStream() || objecta.IsNull()))
{
RefKey key = new RefKey(refa);
PdfIndirectObject obj;
if (!indirectObjects.TryGetValue(key, out obj)) {
obj = new PdfIndirectObject(refa, objecta, this);
indirectObjects[key] = obj;
}
iobj = obj;
} else {
iobj = base.AddToBody(objecta, refa);
}
if (mergeFields && objecta.IsDictionary()) {
PdfNumber annotId = ((PdfDictionary)objecta).GetAsNumber(PdfCopy.annotId);
if (annotId != null) {
if (formBranching) {
mergedMap[annotId.IntValue] = iobj;
mergedSet.Add(iobj);
} else {
unmergedMap[annotId.IntValue] = iobj;
unmergedSet.Add(iobj);
}
}
}
return iobj;
}