本文整理匯總了C#中iTextSharp.text.pdf.PdfContentByte.SetLineCap方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfContentByte.SetLineCap方法的具體用法?C# PdfContentByte.SetLineCap怎麽用?C# PdfContentByte.SetLineCap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfContentByte
的用法示例。
在下文中一共展示了PdfContentByte.SetLineCap方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Draw
/**
* @see com.lowagie.text.pdf.draw.DrawInterface#draw(com.lowagie.text.pdf.PdfContentByte, float, float, float, float, float)
*/
public override void Draw(PdfContentByte canvas, float llx, float lly, float urx, float ury, float y) {
canvas.SaveState();
canvas.SetLineWidth(lineWidth);
canvas.SetLineCap(PdfContentByte.LINE_CAP_ROUND);
canvas.SetLineDash(0, gap, gap / 2);
DrawLine(canvas, llx, urx, y);
canvas.RestoreState();
}
示例2: WriteLineToContent
//.........這裏部分代碼省略.........
yMarker + descender - extra[1] + chunk.TextRise,
width - subtract + extra[0] + extra[2],
ascender - descender + extra[1] + extra[3]);
graphics.Fill();
graphics.SetGrayFill(0);
if (inText && IsTagged(writer)) {
graphics.BeginText(true);
}
}
if (chunk.IsAttribute(Chunk.UNDERLINE) && !chunk.IsNewlineSplit()) {
bool inText = graphics.InText;
if (inText && IsTagged(writer)) {
graphics.EndText();
}
float subtract = lastBaseFactor;
if (nextChunk != null && nextChunk.IsAttribute(Chunk.UNDERLINE))
subtract = 0;
if (nextChunk == null)
subtract += hangingCorrection;
Object[][] unders = (Object[][])chunk.GetAttribute(Chunk.UNDERLINE);
BaseColor scolor = null;
for (int k = 0; k < unders.Length; ++k) {
Object[] obj = unders[k];
scolor = (BaseColor)obj[0];
float[] ps = (float[])obj[1];
if (scolor == null)
scolor = color;
if (scolor != null)
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;
示例3: SetLineCap
void SetLineCap(PdfContentByte cb, IDictionary<String, String> css)
{
String lineCap;
if (css.TryGetValue(SVGAttributes.LINE_CAP, out lineCap) && lineCap != null)
{
if (lineCap.Equals("round"))
{
cb.SetLineCap(PdfContentByte.LINE_CAP_ROUND);
} else if (lineCap.Equals("square")) {
cb.SetLineCap(PdfContentByte.LINE_CAP_PROJECTING_SQUARE);
}
else {
cb.SetLineCap(PdfContentByte.LINE_CAP_BUTT);
}
} else {
cb.SetLineCap(PdfContentByte.LINE_CAP_BUTT);
}
}
示例4: WriteLineToContent
//.........這裏部分代碼省略.........
float ascender = chunk.Font.Font.GetFontDescriptor(BaseFont.ASCENT, fontSize);
float descender = chunk.Font.Font.GetFontDescriptor(BaseFont.DESCENT, fontSize);
Object[] bgr = (Object[])chunk.GetAttribute(Chunk.BACKGROUND);
graphics.SetColorFill((Color)bgr[0]);
float[] extra = (float[])bgr[1];
graphics.Rectangle(xMarker - extra[0],
yMarker + descender - extra[1] + chunk.TextRise,
width - subtract + extra[0] + extra[2],
ascender - descender + extra[1] + extra[3]);
graphics.Fill();
graphics.SetGrayFill(0);
}
if (chunk.IsAttribute(Chunk.UNDERLINE)) {
float subtract = lastBaseFactor;
if (nextChunk != null && nextChunk.IsAttribute(Chunk.UNDERLINE))
subtract = 0;
if (nextChunk == null)
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)) {