本文整理匯總了C#中iTextSharp.text.pdf.PdfReader.KillXref方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfReader.KillXref方法的具體用法?C# PdfReader.KillXref怎麽用?C# PdfReader.KillXref使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfReader
的用法示例。
在下文中一共展示了PdfReader.KillXref方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SetXfa
/**
* Sets the XFA key from a byte array. The old XFA is erased.
* @param form the data
* @param reader the reader
* @param writer the writer
* @throws java.io.IOException on error
*/
public static void SetXfa(XfaForm form, PdfReader reader, PdfWriter writer)
{
PdfDictionary af = (PdfDictionary)PdfReader.GetPdfObjectRelease(reader.Catalog.Get(PdfName.ACROFORM));
if (af == null) {
return;
}
PdfObject xfa = GetXfaObject(reader);
if (xfa.IsArray()) {
PdfArray ar = (PdfArray)xfa;
int t = -1;
int d = -1;
for (int k = 0; k < ar.Size; k += 2) {
PdfString s = ar.GetAsString(k);
if ("template".Equals(s.ToString())) {
t = k + 1;
}
if ("datasets".Equals(s.ToString())) {
d = k + 1;
}
}
if (t > -1 && d > -1) {
reader.KillXref(ar.GetAsIndirectObject(t));
reader.KillXref(ar.GetAsIndirectObject(d));
PdfStream tStream = new PdfStream(SerializeDoc(form.templateNode));
tStream.FlateCompress(writer.CompressionLevel);
ar[t] = writer.AddToBody(tStream).IndirectReference;
PdfStream dStream = new PdfStream(SerializeDoc(form.datasetsNode));
dStream.FlateCompress(writer.CompressionLevel);
ar[d] = writer.AddToBody(dStream).IndirectReference;
af.Put(PdfName.XFA, new PdfArray(ar));
return;
}
}
reader.KillXref(af.Get(PdfName.XFA));
PdfStream str = new PdfStream(SerializeDoc(form.domDocument));
str.FlateCompress(writer.CompressionLevel);
PdfIndirectReference refe = writer.AddToBody(str).IndirectReference;
af.Put(PdfName.XFA, refe);
}
示例2: SetXfa
/**
* Sets the XFA key from a byte array. The old XFA is erased.
* @param xfaData the data
* @param reader the reader
* @param writer the writer
* @throws java.io.IOException on error
*/
public static void SetXfa(byte[] xfaData, PdfReader reader, PdfWriter writer)
{
PdfDictionary af = (PdfDictionary)PdfReader.GetPdfObjectRelease(reader.Catalog.Get(PdfName.ACROFORM));
if (af == null) {
return;
}
reader.KillXref(af.Get(PdfName.XFA));
PdfStream str = new PdfStream(xfaData);
str.FlateCompress();
PdfIndirectReference refe = writer.AddToBody(str).IndirectReference;
af.Put(PdfName.XFA, refe);
}