图像iTextSharp的边框不好

我使用iTextSharp将图像添加到pdf文档中。

当我为图像添加边框时,我会看到Image的一个像素部分(请看截图 ):

截图

当我使用白色作为边框时,它是可见的。

我怎么能删除它?

我的代码

iTextSharp.text.Rectangle rec = new iTextSharp.text.Rectangle(PageSize.A4); iTextSharp.text.Document document = new iTextSharp.text.Document(rec); using (var writer = PdfWriter.GetInstance(document, new FileStream("file.pdf", FileMode.Create))) { document.Open(); iTextSharp.text.Image pic = iTextSharp.text.Image.GetInstance("picture.jpg"); pic.ScaleToFit(document.PageSize.Width, document.PageSize.Height); pic.SetAbsolutePosition(0, (document.PageSize.Height - pic.ScaledHeight) / 2); pic.Border = Image.LEFT_BORDER | Image.TOP_BORDER | Image.RIGHT_BORDER | Image.BOTTOM_BORDER; pic.BorderWidthLeft = 20f; pic.BorderWidthTop = 20f; pic.BorderWidthRight = 20f; pic.BorderWidthBottom = 20f; pic.BorderColor = new iTextSharp.text.BaseColor(System.Drawing.Color.White); document.Add(pic); document.Close(); writer.Close(); }