本文整理匯總了C#中iTextSharp.text.pdf.PdfWriter.GetPageReference方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfWriter.GetPageReference方法的具體用法?C# PdfWriter.GetPageReference怎麽用?C# PdfWriter.GetPageReference使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfWriter
的用法示例。
在下文中一共展示了PdfWriter.GetPageReference方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CreateOutlineAction
internal static void CreateOutlineAction(PdfDictionary outline, Dictionary<String, Object> map, PdfWriter writer, bool namedAsNames) {
try {
String action = GetVal(map, "Action");
if ("GoTo".Equals(action)) {
String p;
if ((p = GetVal(map, "Named")) != null) {
if (namedAsNames)
outline.Put(PdfName.DEST, new PdfName(p));
else
outline.Put(PdfName.DEST, new PdfString(p, null));
}
else if ((p = GetVal(map, "Page")) != null) {
PdfArray ar = new PdfArray();
StringTokenizer tk = new StringTokenizer(p);
int n = int.Parse(tk.NextToken());
ar.Add(writer.GetPageReference(n));
if (!tk.HasMoreTokens()) {
ar.Add(PdfName.XYZ);
ar.Add(new float[]{0, 10000, 0});
}
else {
String fn = tk.NextToken();
if (fn.StartsWith("/"))
fn = fn.Substring(1);
ar.Add(new PdfName(fn));
for (int k = 0; k < 4 && tk.HasMoreTokens(); ++k) {
fn = tk.NextToken();
if (fn.Equals("null"))
ar.Add(PdfNull.PDFNULL);
else
ar.Add(new PdfNumber(fn));
}
}
outline.Put(PdfName.DEST, ar);
}
}
else if ("GoToR".Equals(action)) {
String p;
PdfDictionary dic = new PdfDictionary();
if ((p = GetVal(map, "Named")) != null)
dic.Put(PdfName.D, new PdfString(p, null));
else if ((p = GetVal(map, "NamedN")) != null)
dic.Put(PdfName.D, new PdfName(p));
else if ((p = GetVal(map, "Page")) != null){
PdfArray ar = new PdfArray();
StringTokenizer tk = new StringTokenizer(p);
ar.Add(new PdfNumber(tk.NextToken()));
if (!tk.HasMoreTokens()) {
ar.Add(PdfName.XYZ);
ar.Add(new float[]{0, 10000, 0});
}
else {
String fn = tk.NextToken();
if (fn.StartsWith("/"))
fn = fn.Substring(1);
ar.Add(new PdfName(fn));
for (int k = 0; k < 4 && tk.HasMoreTokens(); ++k) {
fn = tk.NextToken();
if (fn.Equals("null"))
ar.Add(PdfNull.PDFNULL);
else
ar.Add(new PdfNumber(fn));
}
}
dic.Put(PdfName.D, ar);
}
String file = GetVal(map, "File");
if (dic.Size > 0 && file != null) {
dic.Put(PdfName.S, PdfName.GOTOR);
dic.Put(PdfName.F, new PdfString(file));
String nw = GetVal(map, "NewWindow");
if (nw != null) {
if (nw.Equals("true"))
dic.Put(PdfName.NEWWINDOW, PdfBoolean.PDFTRUE);
else if (nw.Equals("false"))
dic.Put(PdfName.NEWWINDOW, PdfBoolean.PDFFALSE);
}
outline.Put(PdfName.A, dic);
}
}
else if ("URI".Equals(action)) {
String uri = GetVal(map, "URI");
if (uri != null) {
PdfDictionary dic = new PdfDictionary();
dic.Put(PdfName.S, PdfName.URI);
dic.Put(PdfName.URI, new PdfString(uri));
outline.Put(PdfName.A, dic);
}
}
else if ("JS".Equals(action)) {
String code = GetVal(map, "Code");
if(code != null) {
outline.Put(PdfName.A, PdfAction.JavaScript(code, writer));
}
}
else if ("Launch".Equals(action)) {
String file = GetVal(map, "File");
if (file != null) {
PdfDictionary dic = new PdfDictionary();
dic.Put(PdfName.S, PdfName.LAUNCH);
//.........這裏部分代碼省略.........
示例2: CreateDestinationArray
internal static PdfArray CreateDestinationArray(String value, PdfWriter writer)
{
PdfArray ar = new PdfArray();
StringTokenizer tk = new StringTokenizer(value);
int n = int.Parse(tk.NextToken());
ar.Add(writer.GetPageReference(n));
if (!tk.HasMoreTokens()) {
ar.Add(PdfName.XYZ);
ar.Add(new float[]{0, 10000, 0});
}
else {
String fn = tk.NextToken();
if (fn.StartsWith("/"))
fn = fn.Substring(1);
ar.Add(new PdfName(fn));
for (int k = 0; k < 4 && tk.HasMoreTokens(); ++k) {
fn = tk.NextToken();
if (fn.Equals("null"))
ar.Add(PdfNull.PDFNULL);
else
ar.Add(new PdfNumber(fn));
}
}
return ar;
}
示例3: CreateAnnotation
public PdfAnnotation CreateAnnotation(PdfWriter writer)
{
PdfAnnotation annotation = new PdfAnnotation(writer, new Rectangle(llx, lly, urx, ury));
if (newPage != 0) {
PdfIndirectReference refi = writer.GetPageReference(newPage);
destination[0] = refi;
}
if (destination != null) annotation.Put(PdfName.DEST, destination);
foreach (PdfName key in parameters.Keys)
annotation.hashMap[key] = parameters[key];
return annotation;
}
示例4: GotoLocalPage
/** Creates a GoTo action to an internal page.
* @param page the page to go. First page is 1
* @param dest the destination for the page
* @param writer the writer for this action
* @return a GoTo action
*/
public static PdfAction GotoLocalPage(int page, PdfDestination dest, PdfWriter writer) {
PdfIndirectReference piref = writer.GetPageReference(page);
PdfDestination d = new PdfDestination(dest);
d.AddPage(piref);
PdfAction action = new PdfAction();
action.Put(PdfName.S, PdfName.GOTO);
action.Put(PdfName.D, d);
return action;
}
示例5: CreateLink
public static PdfAnnotation CreateLink(PdfWriter writer, Rectangle rect, PdfName highlight, int page, PdfDestination dest)
{
PdfAnnotation annot = CreateLink(writer, rect, highlight);
PdfIndirectReference piref = writer.GetPageReference(page);
dest.AddPage(piref);
annot.Put(PdfName.DEST, dest);
return annot;
}