本文整理匯總了C#中iTextSharp.text.pdf.PdfContentByte.AddAnnotation方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfContentByte.AddAnnotation方法的具體用法?C# PdfContentByte.AddAnnotation怎麽用?C# PdfContentByte.AddAnnotation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfContentByte
的用法示例。
在下文中一共展示了PdfContentByte.AddAnnotation方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: WriteLineToContent
//.........這裏部分代碼省略.........
graphics.SetColorStroke(scolor);
graphics.SetLineWidth(ps[0] + fontSize * ps[1]);
float shift = ps[2] + fontSize * ps[3];
int cap2 = (int)ps[4];
if (cap2 != 0)
graphics.SetLineCap(cap2);
graphics.MoveTo(xMarker, yMarker + shift);
graphics.LineTo(xMarker + width - subtract, yMarker + shift);
graphics.Stroke();
if (scolor != null)
graphics.ResetGrayStroke();
if (cap2 != 0)
graphics.SetLineCap(0);
}
graphics.SetLineWidth(1);
if (inText && IsTagged(writer)) {
graphics.BeginText(true);
}
}
if (chunk.IsAttribute(Chunk.ACTION))
{
float subtract = lastBaseFactor;
if (nextChunk != null && nextChunk.IsAttribute(Chunk.ACTION))
subtract = 0;
if (nextChunk == null)
subtract += hangingCorrection;
PdfAnnotation annot = null;
if (chunk.IsImage()) {
annot = new PdfAnnotation(writer, xMarker, yMarker + chunk.ImageOffsetY, xMarker + width - subtract, yMarker + chunk.ImageHeight + chunk.ImageOffsetY, (PdfAction)chunk.GetAttribute(Chunk.ACTION));
}
else {
annot = new PdfAnnotation(writer, xMarker, yMarker + descender + chunk.TextRise, xMarker + width - subtract, yMarker + ascender + chunk.TextRise, (PdfAction)chunk.GetAttribute(Chunk.ACTION));
}
text.AddAnnotation(annot, true);
if (IsTagged(writer) && chunk.accessibleElement != null) {
int structParent = GetStructParentIndex(annot);
annot.Put(PdfName.STRUCTPARENT, new PdfNumber(structParent));
PdfStructureElement strucElem;
structElements.TryGetValue(chunk.accessibleElement.ID, out strucElem);
if (strucElem != null) {
PdfArray kArray = strucElem.GetAsArray(PdfName.K);
if (kArray == null) {
kArray = new PdfArray();
PdfObject k = strucElem.Get(PdfName.K);
if (k != null) {
kArray.Add(k);
}
strucElem.Put(PdfName.K, kArray);
}
PdfDictionary dict = new PdfDictionary();
dict.Put(PdfName.TYPE, PdfName.OBJR);
dict.Put(PdfName.OBJ, annot.IndirectReference);
kArray.Add(dict);
writer.StructureTreeRoot.SetAnnotationMark(structParent, strucElem.Reference);
}
}
}
if (chunk.IsAttribute(Chunk.REMOTEGOTO)) {
float subtract = lastBaseFactor;
if (nextChunk != null && nextChunk.IsAttribute(Chunk.REMOTEGOTO))
subtract = 0;
if (nextChunk == null)
subtract += hangingCorrection;
Object[] obj = (Object[])chunk.GetAttribute(Chunk.REMOTEGOTO);
String filename = (String)obj[0];
if (obj[1] is String)
示例2: WriteLineToContent
//.........這裏部分代碼省略.........
subtract += hangingCorrection;
Object[][] unders = (Object[][])chunk.GetAttribute(Chunk.UNDERLINE);
Color scolor = null;
for (int k = 0; k < unders.Length; ++k) {
Object[] obj = unders[k];
scolor = (Color)obj[0];
float[] ps = (float[])obj[1];
if (scolor == null)
scolor = color;
if (scolor != null)
graphics.SetColorStroke(scolor);
float fsize = chunk.Font.Size;
graphics.SetLineWidth(ps[0] + fsize * ps[1]);
float shift = ps[2] + fsize * ps[3];
int cap2 = (int)ps[4];
if (cap2 != 0)
graphics.SetLineCap(cap2);
graphics.MoveTo(xMarker, yMarker + shift);
graphics.LineTo(xMarker + width - subtract, yMarker + shift);
graphics.Stroke();
if (scolor != null)
graphics.ResetGrayStroke();
if (cap2 != 0)
graphics.SetLineCap(0);
}
graphics.SetLineWidth(1);
}
if (chunk.IsAttribute(Chunk.ACTION)) {
float subtract = lastBaseFactor;
if (nextChunk != null && nextChunk.IsAttribute(Chunk.ACTION))
subtract = 0;
if (nextChunk == null)
subtract += hangingCorrection;
text.AddAnnotation(new PdfAnnotation(writer, xMarker, yMarker, xMarker + width - subtract, yMarker + chunk.Font.Size, (PdfAction)chunk.GetAttribute(Chunk.ACTION)));
}
if (chunk.IsAttribute(Chunk.REMOTEGOTO)) {
float subtract = lastBaseFactor;
if (nextChunk != null && nextChunk.IsAttribute(Chunk.REMOTEGOTO))
subtract = 0;
if (nextChunk == null)
subtract += hangingCorrection;
Object[] obj = (Object[])chunk.GetAttribute(Chunk.REMOTEGOTO);
String filename = (String)obj[0];
if (obj[1] is String)
RemoteGoto(filename, (String)obj[1], xMarker, yMarker, xMarker + width - subtract, yMarker + chunk.Font.Size);
else
RemoteGoto(filename, (int)obj[1], xMarker, yMarker, xMarker + width - subtract, yMarker + chunk.Font.Size);
}
if (chunk.IsAttribute(Chunk.LOCALGOTO)) {
float subtract = lastBaseFactor;
if (nextChunk != null && nextChunk.IsAttribute(Chunk.LOCALGOTO))
subtract = 0;
if (nextChunk == null)
subtract += hangingCorrection;
LocalGoto((String)chunk.GetAttribute(Chunk.LOCALGOTO), xMarker, yMarker, xMarker + width - subtract, yMarker + chunk.Font.Size);
}
if (chunk.IsAttribute(Chunk.LOCALDESTINATION)) {
float subtract = lastBaseFactor;
if (nextChunk != null && nextChunk.IsAttribute(Chunk.LOCALDESTINATION))
subtract = 0;
if (nextChunk == null)
subtract += hangingCorrection;
LocalDestination((String)chunk.GetAttribute(Chunk.LOCALDESTINATION), new PdfDestination(PdfDestination.XYZ, xMarker, yMarker + chunk.Font.Size, 0));
}
if (chunk.IsAttribute(Chunk.GENERICTAG)) {
float subtract = lastBaseFactor;