本文整理汇总了C#中iTextSharp.text.pdf.PdfWriter.CreateAnnotation方法的典型用法代码示例。如果您正苦于以下问题:C# PdfWriter.CreateAnnotation方法的具体用法?C# PdfWriter.CreateAnnotation怎么用?C# PdfWriter.CreateAnnotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp.text.pdf.PdfWriter
的用法示例。
在下文中一共展示了PdfWriter.CreateAnnotation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RichMediaAnnotation
/**
* Creates a RichMediaAnnotation.
* @param writer the PdfWriter to which the annotation will be added.
* @param rect the rectangle where the annotation will be added.
*/
public RichMediaAnnotation(PdfWriter writer, Rectangle rect) {
this.writer = writer;
annot = writer.CreateAnnotation(rect, PdfName.RICHMEDIA);
richMediaContent = new PdfDictionary(PdfName.RICHMEDIACONTENT);
assetsmap = new Dictionary<string,PdfIndirectReference>();
configurations = new PdfArray();
views = new PdfArray();
}
示例2: CreateAnnotation
virtual public PdfAnnotation CreateAnnotation(PdfWriter writer) {
PdfAnnotation annotation = writer.CreateAnnotation(new Rectangle(llx, lly, urx, ury), null);
if (newPage != 0) {
PdfIndirectReference refi = writer.GetPageReference(newPage);
destination.Set(0, refi);
}
if (destination != null) annotation.Put(PdfName.DEST, destination);
foreach (PdfName key in parameters.Keys)
annotation.hashMap[key] = parameters[key];
return annotation;
}
示例3: CreatePopup
public static PdfAnnotation CreatePopup(PdfWriter writer, Rectangle rect, string contents, bool open) {
PdfAnnotation annot = writer.CreateAnnotation(rect, PdfName.POPUP);
if (contents != null)
annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
if (open)
annot.Put(PdfName.OPEN, PdfBoolean.PDFTRUE);
return annot;
}
示例4: CreatePolygonPolyline
/**
* Creates a polygon or -line annotation
* @param writer the PdfWriter
* @param rect the annotation position
* @param contents the textual content of the annotation
* @param polygon if true, the we're creating a polygon annotation, if false, a polyline
* @param vertices an array with the vertices of the polygon or -line
* @since 5.0.2
*/
public static PdfAnnotation CreatePolygonPolyline(
PdfWriter writer, Rectangle rect, String contents, bool polygon, PdfArray vertices) {
PdfAnnotation annot = null;
if (polygon)
annot = writer.CreateAnnotation(rect, PdfName.POLYGON);
else
annot = writer.CreateAnnotation(rect, PdfName.POLYLINE);
annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
annot.Put(PdfName.VERTICES, new PdfArray(vertices));
return annot;
}
示例5: CreateInk
public static PdfAnnotation CreateInk(PdfWriter writer, Rectangle rect, string contents, float[][] inkList) {
PdfAnnotation annot = writer.CreateAnnotation(rect, PdfName.INK);
annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
PdfArray outer = new PdfArray();
for (int k = 0; k < inkList.Length; ++k) {
PdfArray inner = new PdfArray();
float[] deep = inkList[k];
for (int j = 0; j < deep.Length; ++j)
inner.Add(new PdfNumber(deep[j]));
outer.Add(inner);
}
annot.Put(PdfName.INKLIST, outer);
return annot;
}
示例6: CreateFileAttachment
/** Creates a file attachment annotation
* @param writer
* @param rect
* @param contents
* @param fs
* @return the annotation
* @throws IOException
*/
public static PdfAnnotation CreateFileAttachment(PdfWriter writer, Rectangle rect, String contents, PdfFileSpecification fs) {
PdfAnnotation annot = writer.CreateAnnotation(rect, PdfName.FILEATTACHMENT);
if (contents != null)
annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
annot.Put(PdfName.FS, fs.Reference);
return annot;
}
示例7: CreateMarkup
public static PdfAnnotation CreateMarkup(PdfWriter writer, Rectangle rect, string contents, int type, float[] quadPoints) {
PdfName name = PdfName.HIGHLIGHT;
switch (type) {
case MARKUP_UNDERLINE:
name = PdfName.UNDERLINE;
break;
case MARKUP_STRIKEOUT:
name = PdfName.STRIKEOUT;
break;
case MARKUP_SQUIGGLY:
name = PdfName.SQUIGGLY;
break;
}
PdfAnnotation annot = writer.CreateAnnotation(rect, name);
annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
PdfArray array = new PdfArray();
for (int k = 0; k < quadPoints.Length; ++k)
array.Add(new PdfNumber(quadPoints[k]));
annot.Put(PdfName.QUADPOINTS, array);
return annot;
}
示例8: CreateStamp
public static PdfAnnotation CreateStamp(PdfWriter writer, Rectangle rect, string contents, string name) {
PdfAnnotation annot = writer.CreateAnnotation(rect, PdfName.STAMP);
annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
annot.Put(PdfName.NAME, new PdfName(name));
return annot;
}
示例9: CreateLine
public static PdfAnnotation CreateLine(PdfWriter writer, Rectangle rect, string contents, float x1, float y1, float x2, float y2) {
PdfAnnotation annot = writer.CreateAnnotation(rect, PdfName.LINE);
annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
PdfArray array = new PdfArray(new PdfNumber(x1));
array.Add(new PdfNumber(y1));
array.Add(new PdfNumber(x2));
array.Add(new PdfNumber(y2));
annot.Put(PdfName.L, array);
return annot;
}
示例10: CreateSquareCircle
public static PdfAnnotation CreateSquareCircle(PdfWriter writer, Rectangle rect, string contents, bool square) {
PdfAnnotation annot;
if (square)
annot = writer.CreateAnnotation(rect, PdfName.SQUARE);
else
annot = writer.CreateAnnotation(rect, PdfName.CIRCLE);
annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
return annot;
}
示例11: CreateFreeText
public static PdfAnnotation CreateFreeText(PdfWriter writer, Rectangle rect, string contents, PdfContentByte defaultAppearance) {
PdfAnnotation annot = writer.CreateAnnotation(rect, PdfName.FREETEXT);
annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
annot.DefaultAppearanceString = defaultAppearance;
return annot;
}
示例12: CreateLink
protected static PdfAnnotation CreateLink(PdfWriter writer, Rectangle rect, PdfName highlight) {
PdfAnnotation annot = writer.CreateAnnotation(rect, PdfName.LINK);
if (!highlight.Equals(HIGHLIGHT_INVERT))
annot.Put(PdfName.H, highlight);
return annot;
}
示例13: CreateText
public static PdfAnnotation CreateText(PdfWriter writer, Rectangle rect, string title, string contents, bool open, string icon) {
PdfAnnotation annot = writer.CreateAnnotation(rect, PdfName.TEXT);
if (title != null)
annot.Put(PdfName.T, new PdfString(title, PdfObject.TEXT_UNICODE));
if (contents != null)
annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
if (open)
annot.Put(PdfName.OPEN, PdfBoolean.PDFTRUE);
if (icon != null) {
annot.Put(PdfName.NAME, new PdfName(icon));
}
return annot;
}
示例14: CreateScreen
/**
* Creates a screen PdfAnnotation
* @param writer
* @param rect
* @param clipTitle
* @param fs
* @param mimeType
* @param playOnDisplay
* @return a screen PdfAnnotation
* @throws IOException
*/
public static PdfAnnotation CreateScreen(PdfWriter writer, Rectangle rect, String clipTitle, PdfFileSpecification fs,
String mimeType, bool playOnDisplay) {
PdfAnnotation ann = writer.CreateAnnotation(rect, PdfName.SCREEN);
ann.Put (PdfName.F, new PdfNumber(FLAGS_PRINT));
ann.Put(PdfName.TYPE, PdfName.ANNOT);
ann.SetPage();
PdfIndirectReference refi = ann.IndirectReference;
PdfAction action = PdfAction.Rendition(clipTitle,fs,mimeType, refi);
PdfIndirectReference actionRef = writer.AddToBody(action).IndirectReference;
// for play on display add trigger event
if (playOnDisplay)
{
PdfDictionary aa = new PdfDictionary();
aa.Put(new PdfName("PV"), actionRef);
ann.Put(PdfName.AA, aa);
}
ann.Put(PdfName.A, actionRef);
return ann;
}
示例15: ConvertAnnotation
public static PdfAnnotation ConvertAnnotation(PdfWriter writer, Annotation annot, Rectangle defaultRect) {
switch (annot.AnnotationType) {
case Annotation.URL_NET:
return writer.CreateAnnotation(annot.GetLlx(), annot.GetLly(), annot.GetUrx(), annot.GetUry(), new PdfAction((Uri)annot.Attributes[Annotation.URL]), null);
case Annotation.URL_AS_STRING:
return writer.CreateAnnotation(annot.GetLlx(), annot.GetLly(), annot.GetUrx(), annot.GetUry(), new PdfAction((String)annot.Attributes[Annotation.FILE]), null);
case Annotation.FILE_DEST:
return writer.CreateAnnotation(annot.GetLlx(), annot.GetLly(), annot.GetUrx(), annot.GetUry(), new PdfAction((String)annot.Attributes[Annotation.FILE], (String)annot.Attributes[Annotation.DESTINATION]), null);
case Annotation.SCREEN:
bool[] sparams = (bool[])annot.Attributes[Annotation.PARAMETERS];
String fname = (String) annot.Attributes[Annotation.FILE];
String mimetype = (String) annot.Attributes[Annotation.MIMETYPE];
PdfFileSpecification fs;
if (sparams[0])
fs = PdfFileSpecification.FileEmbedded(writer, fname, fname, null);
else
fs = PdfFileSpecification.FileExtern(writer, fname);
PdfAnnotation ann = PdfAnnotation.CreateScreen(writer, new Rectangle(annot.GetLlx(), annot.GetLly(), annot.GetUrx(), annot.GetUry()),
fname, fs, mimetype, sparams[1]);
return ann;
case Annotation.FILE_PAGE:
return writer.CreateAnnotation(annot.GetLlx(), annot.GetLly(), annot.GetUrx(), annot.GetUry(), new PdfAction((String)annot.Attributes[Annotation.FILE], ((int?)annot.Attributes[Annotation.PAGE]).Value), null);
case Annotation.NAMED_DEST:
return writer.CreateAnnotation(annot.GetLlx(), annot.GetLly(), annot.GetUrx(), annot.GetUry(), new PdfAction(((int?)annot.Attributes[Annotation.NAMED]).Value), null);
case Annotation.LAUNCH:
return writer.CreateAnnotation(annot.GetLlx(), annot.GetLly(), annot.GetUrx(), annot.GetUry(), new PdfAction((String)annot.Attributes[Annotation.APPLICATION], (String)annot.Attributes[Annotation.PARAMETERS], (String)annot.Attributes[Annotation.OPERATION], (String)annot.Attributes[Annotation.DEFAULTDIR]), null);
default:
return writer.CreateAnnotation(defaultRect.Left, defaultRect.Bottom, defaultRect.Right, defaultRect.Top, new PdfString(annot.Title, PdfObject.TEXT_UNICODE), new PdfString(annot.Content, PdfObject.TEXT_UNICODE), null);
}
}