How to improve image quality in iTextSharp.
I was working in question paper project. in this project I need to generate PDF file from images. but when I generated the PDF file, image's quality was so bad. so to overcome this problem I have used listed below code.
System.Drawing.Image image = System.Drawing.Image.FromFile("myimage.jpg");
iTextSharp.text.Document doc = new iTextSharp.text.Document(PageSize.A4);
doc.Open();
doc.Add(new Paragraph(""));
PdfWriter.GetInstance(doc, new FileStream("my.pdf", FileMode.Create));
iTextSharp.text.Image pdfImage = iTextSharp.text.Image.GetInstance(image, System.Drawing.Imaging.ImageFormat.Jpeg);
I was working in question paper project. in this project I need to generate PDF file from images. but when I generated the PDF file, image's quality was so bad. so to overcome this problem I have used listed below code.
System.Drawing.Image image = System.Drawing.Image.FromFile("myimage.jpg");
iTextSharp.text.Document doc = new iTextSharp.text.Document(PageSize.A4);
doc.Open();
doc.Add(new Paragraph(""));
PdfWriter.GetInstance(doc, new FileStream("my.pdf", FileMode.Create));
iTextSharp.text.Image pdfImage = iTextSharp.text.Image.GetInstance(image, System.Drawing.Imaging.ImageFormat.Jpeg);
pdfImage.ScalePercent(50f);
doc.Add(pdfImage);
doc.Close();