如何创建从System.Drawing.Bitmap对象开始的iTextSharp.text.Image对象?我是iTextSharp(iText的C#版本)的新手:我有这样的东西:System.Drawing.Bitmapbitmap=(System.Drawing.Bitmap)ChartHelper.GetPdfChart((int)currentVuln.UrgencyRating*10);iTextSharp.text.Imageimg=iTextSharp.text.Image.GetInstance(位图);vulnerabilityDetailsTable.AddCell(newPdfPCell(img){Border=PdfPCell.RIGHT_BORDER,BorderColor=newBaseColor(79,129,189),BorderWidth=1,Padding=5,MinimumHeight=30,PaddingTop=10});如您所见,我有一个名为bitmap的经典System.Drawing.Bitmap图像,我想将它放在PDF文档表格的一个单元格中。问题是此行被标记为错误:iTextSharp.text.Imageimg=iTextSharp.text.Image.GetInstance(bitmap);错误是:错误75'iTextSharp.text.Image.GetInstance(iTextSharp.text.Image)'最佳重载方法匹配包含一些无效参数c:DevelopEarlyWarningpublicImplementazioneVer2PdfReportPdfVulnerability.cs12027PdfReport所以我想我需要从经典的System.Drawing.Bitmap对象中获取iTextSharp.text.Image对象。我该怎么办?我试着发疯。TNX没有重载,只需要System.Drawing.Image。您需要使用其中之一:GetInstance(System.Drawing.Imageimage,BaseColorcolor)GetInstance(System.Drawing.Imageimage,BaseColorcolor,boolforceBW)GetInstance(System.Drawing.Imageimage,System.Drawing.Imaging.ImageFormat格式)第一个可能是最好的选择,我99%确定你可以为颜色参数传递null。以上是C#学习教程:HowtocreateaniTextSharp.text.ImageobjectstartngtoaSystem.Drawing.Bitmapobject?如果所有分享的内容对你有用,需要进一步了解C#学习教程,希望大家多多关注。本文收集自网络,不代表立场。如涉及侵权,请点击右侧联系管理员删除。如需转载请注明出处:
