本文整理汇总了C#中iTextSharp.text.pdf.PRIndirectReference类的典型用法代码示例。如果您正苦于以下问题:C# PRIndirectReference类的具体用法?C# PRIndirectReference怎么用?C# PRIndirectReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PRIndirectReference类属于iTextSharp.text.pdf命名空间,在下文中一共展示了PRIndirectReference类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OutlineTravel
private void OutlineTravel(PRIndirectReference outline) {
while (outline != null) {
PdfDictionary outlineR = (PdfDictionary)PdfReader.GetPdfObjectRelease(outline);
PRIndirectReference first = (PRIndirectReference)outlineR.Get(PdfName.FIRST);
if (first != null) {
OutlineTravel(first);
}
PdfReader.KillIndirect(outlineR.Get(PdfName.DEST));
PdfReader.KillIndirect(outlineR.Get(PdfName.A));
PdfReader.KillIndirect(outline);
outline = (PRIndirectReference)outlineR.Get(PdfName.NEXT);
}
}
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:13,代码来源:PdfStamperImp.cs
示例2: FieldInformation
internal FieldInformation(String fieldName, PdfDictionary info, PRIndirectReference refi) {
this.fieldName = fieldName;
this.info = info;
this.refi = refi;
}
开发者ID:jagruti23,项目名称:itextsharp,代码行数:5,代码来源:PRAcroForm.cs
示例3: RefKey
internal RefKey(PRIndirectReference refi)
{
num = refi.Number;
gen = refi.Generation;
}
开发者ID:boecko,项目名称:iTextSharp,代码行数:5,代码来源:PdfCopy.cs
示例4: IterateFields
/**
* After reading, we index all of the fields. Recursive.
* @param fieldlist An array of fields
* @param fieldDict the last field dictionary we encountered (recursively)
* @param parentPath the pathname of the field, up to this point or null
*/
virtual protected void IterateFields(PdfArray fieldlist, PRIndirectReference fieldDict, String parentPath) {
foreach (PRIndirectReference refi in fieldlist.ArrayList) {
PdfDictionary dict = (PdfDictionary) PdfReader.GetPdfObjectRelease(refi);
// if we are not a field dictionary, pass our parent's values
PRIndirectReference myFieldDict = fieldDict;
String fullPath = parentPath;
PdfString tField = (PdfString)dict.Get(PdfName.T);
bool isFieldDict = tField != null;
if (isFieldDict) {
myFieldDict = refi;
if (parentPath == null) {
fullPath = tField.ToString();
} else {
fullPath = parentPath + '.' + tField.ToString();
}
}
PdfArray kids = (PdfArray)dict.Get(PdfName.KIDS);
if (kids != null) {
PushAttrib(dict);
IterateFields(kids, myFieldDict, fullPath);
stack.RemoveAt(stack.Count - 1); // pop
}
else { // leaf node
if (myFieldDict != null) {
PdfDictionary mergedDict = (PdfDictionary)stack[stack.Count - 1];
if (isFieldDict)
mergedDict = MergeAttrib(mergedDict, dict);
mergedDict.Put(PdfName.T, new PdfString(fullPath));
FieldInformation fi = new FieldInformation(fullPath, mergedDict, myFieldDict);
fields.Add(fi);
fieldByName[fullPath] = fi;
}
}
}
}
开发者ID:jagruti23,项目名称:itextsharp,代码行数:45,代码来源:PRAcroForm.cs
示例5: InsertPage
internal void InsertPage(int pageNumber, Rectangle mediabox)
{
Rectangle media = new Rectangle(mediabox);
int rotation = media.Rotation % 360;
PdfDictionary page = new PdfDictionary(PdfName.PAGE);
PdfDictionary resources = new PdfDictionary();
PdfArray procset = new PdfArray();
procset.Add(PdfName.PDF);
procset.Add(PdfName.TEXT);
procset.Add(PdfName.IMAGEB);
procset.Add(PdfName.IMAGEC);
procset.Add(PdfName.IMAGEI);
resources.Put(PdfName.PROCSET, procset);
page.Put(PdfName.RESOURCES, resources);
page.Put(PdfName.ROTATE, new PdfNumber(rotation));
page.Put(PdfName.MEDIABOX, new PdfRectangle(media, rotation));
PRIndirectReference pref = reader.AddPdfObject(page);
PdfDictionary parent;
PRIndirectReference parentRef;
if (pageNumber > reader.NumberOfPages) {
PdfDictionary lastPage = reader.GetPageNRelease(reader.NumberOfPages);
parentRef = (PRIndirectReference)lastPage.Get(PdfName.PARENT);
parentRef = new PRIndirectReference(reader, parentRef.Number);
parent = (PdfDictionary)PdfReader.GetPdfObject(parentRef);
PdfArray kids = (PdfArray)PdfReader.GetPdfObject(parent.Get(PdfName.KIDS), parent);
kids.Add(pref);
MarkUsed(kids);
reader.pageRefs.InsertPage(pageNumber, pref);
}
else {
if (pageNumber < 1)
pageNumber = 1;
PdfDictionary firstPage = reader.GetPageN(pageNumber);
PRIndirectReference firstPageRef = reader.GetPageOrigRef(pageNumber);
reader.ReleasePage(pageNumber);
parentRef = (PRIndirectReference)firstPage.Get(PdfName.PARENT);
parentRef = new PRIndirectReference(reader, parentRef.Number);
parent = (PdfDictionary)PdfReader.GetPdfObject(parentRef);
PdfArray kids = (PdfArray)PdfReader.GetPdfObject(parent.Get(PdfName.KIDS), parent);
ArrayList ar = kids.ArrayList;
int len = ar.Count;
int num = firstPageRef.Number;
for (int k = 0; k < len; ++k) {
PRIndirectReference cur = (PRIndirectReference)ar[k];
if (num == cur.Number) {
ar.Insert(k, pref);
break;
}
}
if (len == ar.Count)
throw new Exception("Internal inconsistence.");
MarkUsed(kids);
reader.pageRefs.InsertPage(pageNumber, pref);
CorrectAcroFieldPages(pageNumber);
}
page.Put(PdfName.PARENT, parentRef);
while (parent != null) {
MarkUsed(parent);
PdfNumber count = (PdfNumber)PdfReader.GetPdfObjectRelease(parent.Get(PdfName.COUNT));
parent.Put(PdfName.COUNT, new PdfNumber(count.IntValue + 1));
parent = (PdfDictionary)PdfReader.GetPdfObject(parent.Get(PdfName.PARENT));
}
}
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:63,代码来源:PdfStamperImp.cs
示例6: GetInstance
/**
* Reuses an existing image.
* @param ref the reference to the image dictionary
* @throws BadElementException on error
* @return the image
*/
public static Image GetInstance(PRIndirectReference iref) {
PdfDictionary dic = (PdfDictionary)PdfReader.GetPdfObjectRelease(iref);
int width = ((PdfNumber)PdfReader.GetPdfObjectRelease(dic.Get(PdfName.WIDTH))).IntValue;
int height = ((PdfNumber)PdfReader.GetPdfObjectRelease(dic.Get(PdfName.HEIGHT))).IntValue;
Image imask = null;
PdfObject obj = dic.Get(PdfName.SMASK);
if (obj != null && obj.IsIndirect()) {
imask = GetInstance((PRIndirectReference)obj);
}
else {
obj = dic.Get(PdfName.MASK);
if (obj != null && obj.IsIndirect()) {
PdfObject obj2 = PdfReader.GetPdfObjectRelease(obj);
if (obj2 is PdfDictionary)
imask = GetInstance((PRIndirectReference)obj);
}
}
Image img = new ImgRaw(width, height, 1, 1, null);
img.imageMask = imask;
img.directReference = iref;
return img;
}
开发者ID:Gianluigi,项目名称:dssnet,代码行数:28,代码来源:Image.cs
示例7: InsertPage
internal void InsertPage(int pageNumber, Rectangle mediabox) {
Rectangle media = new Rectangle(mediabox);
int rotation = media.Rotation % 360;
PdfDictionary page = new PdfDictionary(PdfName.PAGE);
page.Put(PdfName.RESOURCES, new PdfDictionary());
page.Put(PdfName.ROTATE, new PdfNumber(rotation));
page.Put(PdfName.MEDIABOX, new PdfRectangle(media, rotation));
PRIndirectReference pref = reader.AddPdfObject(page);
PdfDictionary parent;
PRIndirectReference parentRef;
if (pageNumber > reader.NumberOfPages) {
PdfDictionary lastPage = reader.GetPageNRelease(reader.NumberOfPages);
parentRef = (PRIndirectReference)lastPage.Get(PdfName.PARENT);
parentRef = new PRIndirectReference(reader, parentRef.Number);
parent = (PdfDictionary)PdfReader.GetPdfObject(parentRef);
PdfArray kids = (PdfArray)PdfReader.GetPdfObject(parent.Get(PdfName.KIDS), parent);
kids.Add(pref);
MarkUsed(kids);
reader.pageRefs.InsertPage(pageNumber, pref);
}
else {
if (pageNumber < 1)
pageNumber = 1;
PdfDictionary firstPage = reader.GetPageN(pageNumber);
PRIndirectReference firstPageRef = reader.GetPageOrigRef(pageNumber);
reader.ReleasePage(pageNumber);
parentRef = (PRIndirectReference)firstPage.Get(PdfName.PARENT);
parentRef = new PRIndirectReference(reader, parentRef.Number);
parent = (PdfDictionary)PdfReader.GetPdfObject(parentRef);
PdfArray kids = (PdfArray)PdfReader.GetPdfObject(parent.Get(PdfName.KIDS), parent);
int len = kids.Size;
int num = firstPageRef.Number;
for (int k = 0; k < len; ++k) {
PRIndirectReference cur = (PRIndirectReference)kids[k];
if (num == cur.Number) {
kids.Add(k, pref);
break;
}
}
if (len == kids.Size)
throw new Exception(MessageLocalization.GetComposedMessage("internal.inconsistence"));
MarkUsed(kids);
reader.pageRefs.InsertPage(pageNumber, pref);
CorrectAcroFieldPages(pageNumber);
}
page.Put(PdfName.PARENT, parentRef);
while (parent != null) {
MarkUsed(parent);
PdfNumber count = (PdfNumber)PdfReader.GetPdfObjectRelease(parent.Get(PdfName.COUNT));
parent.Put(PdfName.COUNT, new PdfNumber(count.IntValue + 1));
parent = parent.GetAsDict(PdfName.PARENT);
}
}
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:53,代码来源:PdfStamperImp.cs
示例8: CopyIndirect
/**
* Translate a PRIndirectReference to a PdfIndirectReference
* In addition, translates the object numbers, and copies the
* referenced object to the output file.
* NB: PRIndirectReferences (and PRIndirectObjects) really need to know what
* file they came from, because each file has its own namespace. The translation
* we do from their namespace to ours is *at best* heuristic, and guaranteed to
* fail under some circumstances.
*/
protected virtual PdfIndirectReference CopyIndirect(PRIndirectReference inp)
{
PdfIndirectReference theRef;
RefKey key = new RefKey(inp);
IndirectReferences iRef;
indirects.TryGetValue(key, out iRef);
if (iRef != null) {
theRef = iRef.Ref;
if (iRef.Copied) {
return theRef;
}
}
else {
theRef = body.PdfIndirectReference;
iRef = new IndirectReferences(theRef);
indirects[key] = iRef;
}
PdfObject obj = PdfReader.GetPdfObjectRelease(inp);
if (obj != null && obj.IsDictionary()) {
PdfObject type = PdfReader.GetPdfObjectRelease(((PdfDictionary)obj).Get(PdfName.TYPE));
if (type != null && PdfName.PAGE.Equals(type)) {
return theRef;
}
}
iRef.SetCopied();
obj = CopyObject(obj);
AddToBody(obj, theRef);
return theRef;
}
开发者ID:boecko,项目名称:iTextSharp,代码行数:38,代码来源:PdfCopy.cs
示例9: DocumentFont
/** Creates a new instance of DocumentFont */
internal DocumentFont(PdfDictionary font) {
this.refFont = null;
this.font = font;
Init();
}
开发者ID:Gianluigi,项目名称:dssnet,代码行数:6,代码来源:DocumentFont.cs
注:本文中的iTextSharp.text.pdf.PRIndirectReference类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论