即时通讯使用itextsharp导出图像为pdf。 ----我想使图像的边缘平滑(曲线边缘), ----以及通过itextsharp图像属性获取图像的宽度和高度(同时从磁盘获取图像) ----和还如何设置PDF页面如何平滑图像的边缘从磁盘/导出到pdf(c#)
的背景颜色以下是获取图像,并添加到PDF:
pdfDoc.Open();
//pdfDoc.Add(new iTextSharp.text.Paragraph("Welcome to dotnetfox"));
iTextSharp.text.Image gif = iTextSharp.text.Image.GetInstance(@"C:\Users\Admin\Desktop\logoall.bmp");
// gif.ScaleToFit(500, 100);
pdfDoc.Add(gif);
以下是使网格图像并保存到磁盘:
Grid companysnapshot = values[0] as Grid; //companysnap shot
companysnapshot.Measure(new System.Windows.Size(double.PositiveInfinity, double.PositiveInfinity));
int companywidth = (int)Math.Round(companysnapshot.ActualWidth);
int companyheight = (int)Math.Round(companysnapshot.ActualHeight);
companywidth = companywidth == 0 ? 1 : companywidth;
companyheight = companyheight == 0 ? 1 : companyheight;
RenderTargetBitmap rtbmp = new RenderTargetBitmap(companywidth, companyheight, 96d, 96d, PixelFormats.Default);
rtbmp.Render(companysnapshot);
BmpBitmapEncoder encoder = new BmpBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(rtbmp));
FileStream fs1 = File.Create(@"C:\Users\Admin\Desktop\companyss.bmp");
encoder.Save(fs1);
fs1.Close();
请鳕鱼我出来这个!
位图图像总是一个矩形。在这种情况下,“平滑边缘”是什么意思? – usr2564301 2014-09-20 09:23:15