即時通訊使用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