I'm trying to put an image in the pdf, but the error because the Image class of ItextSharp only accepts Uri, and what I have is an incoming stream that already converted to System.Drawing.Image.
public static Document GeraPdf(Stream stream)
{
Document doc = new Document(PageSize.A4);
doc.SetMargins(40, 40, 40, 80);
doc.AddCreationDate();
string caminho = @"C:\Users\ASUS\Desktop\eae.pdf";
PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(caminho, FileMode.Create));
doc.Open();
string dados = "";
System.Drawing.Image img1 = System.Drawing.Image.FromStream(stream);
Image ImagemPdf= Image.GetInstance(img1,ImageFormat.Jpeg);//Aqui esta o Erro
Paragraph paragrafo = new Paragraph(dados, new Font(Font.NORMAL, 14));
paragrafo.Alignment = Element.ALIGN_JUSTIFIED;
paragrafo.Add("TESTE TESTE TESTE");
doc.Add(paragrafo);
doc.Close();
return doc;
}