post by yamamoto | 0 | 2,489 views

CSharpのGraphicsをiTextSharpのPDFに描く


bmp = new Bitmap(100, 100);
Graphics g = Graphics.FromImage(bmp);
string s = “あいうえお”;
float w = g.MeasureString(s, Font).Width;
for (int i = 0; i < 10; ++i)
for (int j = 0; j < 20; ++j)
g.DrawString(s, Font, Brushes.Red, w * j, i * Font.Height);
//using iTextImage=iTextSharp.Text.Image;

iTextImage image = iTextImage.GetInstance(bmp,iColor.WHITE);

image.SetAbsolutePosition(0, 0);

doc.Add(image);



↑ こちらはJava用ですが、とても参考になると思います。

Related posts:

Comments are closed.