本文整理匯總了C#中iTextSharp.text.pdf.PdfContentByte.Add方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfContentByte.Add方法的具體用法?C# PdfContentByte.Add怎麽用?C# PdfContentByte.Add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfContentByte
的用法示例。
在下文中一共展示了PdfContentByte.Add方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Draw
protected override void Draw(PdfContentByte cb)
{
//TODO if width and height not know: what to do
//PdfTemplate template = cb.CreateTemplate(this.width, this.height);
PdfTemplate template = cb.CreateTemplate(500, 500);
//draw the list of elements on the new template
foreach (IElement elem in this.list)
{
Graphic graphic = (Graphic)elem;
if (applyCSSToElements)
{
graphic.Draw(template, GetCombinedCss(graphic.GetCss(), GetCss()));
}
else
{
graphic.Draw(template, graphic.GetCss());
}
}
//add the template at the x, y position
System.Drawing.Drawing2D.Matrix translation = new System.Drawing.Drawing2D.Matrix();
translation.Translate(this.x, this.y);
cb.ConcatCTM(translation);
cb.Add(template);
}
示例2: DrawGroup
void DrawGroup(PdfContentByte cb)
{
//TODO if width and height not know: what to do
//PdfTemplate template = cb.CreateTemplate(this.width, this.height);
PdfTemplate template = cb.CreateTemplate(500, 500);
//draw the list of elements on the new template
IList<int> xSpacing = null, ySpacing = null;
float defaultSpacing = template.CharacterSpacing;
float rise = 0;
template.BeginText();
//
foreach (IElement elem in this.list)
{
Text text = (Text)elem;
//CssSvgAppliers.GetInstance().ApplyForText(, text.GetCss(), text.GetChunk());
CssSvgAppliers.GetInstance().ApplyForText(template, text.GetCss(), text.GetChunk());
if (!text.IsRelative())
{
//when there are x,y coordinates in the text or tspan
template.SetTextMatrix(text.GetX(), -1 * text.GetY());
}
//System.out.Println(text.chunk.GetFont());
//the spacing
if (text.Dx != null)
{
xSpacing = text.Dx;
}
if (text.Dy != null)
{
ySpacing = text.Dy;
rise = 0;
}
if (xSpacing != null || ySpacing != null)
{
String display = text.GetText();
for (int i = 0; i < display.Length; i++)
{
if (xSpacing != null && xSpacing.Count > 0)
{
template.SetCharacterSpacing(xSpacing[0]);
xSpacing.Remove(0);
}
if (ySpacing != null && ySpacing.Count > 0)
{
rise = rise - ySpacing[0];
template.SetTextRise(rise);
ySpacing.Remove(0);
}
else
{
template.SetTextRise(rise);
}
template.ShowText(display.Substring(i, 1));
template.SetCharacterSpacing(defaultSpacing);
}
}
else
{
template.ShowText(text.GetText());
}
}
template.EndText();
//add the template at the x, y position
cb.ConcatCTM(1, 0, 0, -1, 0, 0);
cb.Add(template);
}