C# iTextsharp-将单选按钮图像添加到.pdf

C# iTextsharp-将单选按钮图像添加到.pdf,c#,itext,C#,Itext,如何将radiobutton的图像添加到.pdf 我用过它。选中单选按钮的图像应反映到.pdf注释中,很明显,OP希望将系统.Drawing.Bitmap图像(他碰巧从GUI单选按钮的图像属性中检索到)添加到pdf 您可以通过其iTextSharp.text.image类将PDF中的图像与iText一起使用 System.Drawing.Image drawingImage = radioButton54.Image; iTextSharp.text.Image image = iTextSha

如何将radiobutton的图像添加到.pdf


我用过它。选中单选按钮的图像应反映到.pdf

注释中,很明显,OP希望将
系统.Drawing.Bitmap
图像(他碰巧从GUI单选按钮的
图像
属性中检索到)添加到pdf

您可以通过其
iTextSharp.text.image
类将PDF中的图像与iText一起使用

System.Drawing.Image drawingImage = radioButton54.Image;
iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(drawingImage, BaseColor.WHITE);
image.ScaleToFit(10, 10);
如果要将其内联添加到段落中,请将其包装成
,然后将其与文本并排添加到段落中:

Paragraph paragraph = new Paragraph();
paragraph.Add("Hello, World!");
paragraph.Add(new Chunk(image, 0, 0));
paragraph.Add("Bye, World!");
document.Add(paragraph);
使用我手边的示例图像,这创建了如下内容:


“如何将radiobutton的图像添加到.pdf?”-图像是指实际的位图图像?还是要添加单选按钮表单元素?“选中单选按钮的图像应反射到.pdf”-反射到.pdf是什么意思?也就是说,你们尝试了什么,是什么让你们停止了?我的意思是从radiobutton属性,添加图标为System.Drawing.Bitmap。。。它的绿色勾选符号为.png格式。这个小图标图片也可以在.pdf上看到?if(radioButton54.Checked){paragration soru1=新段落(label10.Text+“”+radioButton54.Text);pdfDosya.Add(soru1);}else if(radioButton122.Checked){paragration soru1=新段落(label10.Text+“”+radioButton122.Text);pdfDosya.Add(soru1);}如果(radioButton1.Checked){段落soru1=新段落(label10.Text+“”+radioButton1.Text);pdfDosya.Add(soru1);}我添加了+radioButton54.Image,但它在.pdfSo处显示为System.Drawing.Bitmap。如果您想在PDF中添加一个图像,该图像的形式为
System.Drawing.Bitmap
对象……为什么您一开始不这么说,没有人会猜到您的问题。(以防万一你们想知道为什么你们的问题有三张反对票和四张接近票…)嗨,mkl,它现在工作得很好。很抱歉把问题描述得很复杂。