本文整理汇总了C#中Chunk.GetImage方法的典型用法代码示例。如果您正苦于以下问题:C# Chunk.GetImage方法的具体用法?C# Chunk.GetImage怎么用?C# Chunk.GetImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chunk
的用法示例。
在下文中一共展示了Chunk.GetImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteAttributes
private void WriteAttributes(Chunk chunk)
{
if (chunk != null)
{
if (chunk.GetImage() != null)
WriteAttributes(chunk.GetImage());
else
{
Dictionary<String, Object> attr = chunk.Attributes;
if (attr != null)
{
// Setting non-inheritable attributes
if (attr.ContainsKey(Chunk.UNDERLINE))
this.SetAttribute(PdfName.TEXTDECORATIONTYPE, PdfName.UNDERLINE);
if (attr.ContainsKey(Chunk.BACKGROUND))
{
Object[] back = (Object[]) attr[Chunk.BACKGROUND];
BaseColor color = (BaseColor) back[0];
this.SetAttribute(PdfName.BACKGROUNDCOLOR,
new PdfArray(new float[] {color.R/255f, color.G/255f, color.B/255f}));
}
// Setting inheritable attributes
IPdfStructureElement parent = (IPdfStructureElement) this.GetParent(true);
PdfObject obj = parent.GetAttribute(PdfName.COLOR);
if ((chunk.Font != null) && (chunk.Font.Color != null))
{
BaseColor c = chunk.Font.Color;
SetColorAttribute(c, obj, PdfName.COLOR);
}
PdfObject decorThickness = parent.GetAttribute(PdfName.TEXTDECORATIONTHICKNESS);
PdfObject decorColor = parent.GetAttribute(PdfName.TEXTDECORATIONCOLOR);
if (attr.ContainsKey(Chunk.UNDERLINE))
{
Object[][] unders = (Object[][]) attr[Chunk.UNDERLINE];
Object[] arr = unders[unders.Length - 1];
BaseColor color = (BaseColor) arr[0];
float[] floats = (float[]) arr[1];
float thickness = floats[0];
// Setting thickness
if (decorThickness is PdfNumber)
{
float t = ((PdfNumber) decorThickness).FloatValue;
if (thickness.CompareTo(t) != 0)
this.SetAttribute(PdfName.TEXTDECORATIONTHICKNESS, new PdfNumber(thickness));
}
else
this.SetAttribute(PdfName.TEXTDECORATIONTHICKNESS, new PdfNumber(thickness));
// Setting decoration color
if (color != null)
SetColorAttribute(color, decorColor, PdfName.TEXTDECORATIONCOLOR);
}
if (attr.ContainsKey(Chunk.LINEHEIGHT))
{
float height = (float) attr[Chunk.LINEHEIGHT];
PdfObject parentLH = parent.GetAttribute(PdfName.LINEHEIGHT);
if (parentLH is PdfNumber)
{
float pLH = ((PdfNumber) parentLH).FloatValue;
if (pLH.CompareTo(height) != 0)
this.SetAttribute(PdfName.LINEHEIGHT, new PdfNumber(height));
}
else
this.SetAttribute(PdfName.LINEHEIGHT, new PdfNumber(height));
}
}
}
}
}