首页 > 解决方案 > 如何使用 ItextSharp 在图像周围绘制圆圈

问题描述

        byte[] byt = DMC_StudentImage;
        Image img = Image.GetInstance(byt);
        float width = 100f;
        float height = 100f;

        PdfContentByte content = writer.DirectContent;            
        PdfTemplate temp = content.CreateTemplate(width, height);           
        temp.Ellipse(0, 0, width, height);
        temp.Clip();
        temp.NewPath();
        temp.AddImage(img, width, 0, 0, height, 0, 0);
        Image clipped = Image.GetInstance(temp);

我已经在上面的代码的帮助下成功地剪辑了一个图像,如图 1 所示,现在我想在图像周围添加圆圈,如图 2 所示。 在此处输入图像描述

标签: c#itext

解决方案


你可以用后面的圆圈做一个png图像,并在将图像添加到文档后将其放置。


推荐阅读