I'm using this version: "PDFSharp-MigraDocFoundation-1_31" (only the PDFsharp part).
I have a Bitmap in my C# (winforms) application. This bitmap is like a screenshot of the form.
When I save this bitmap to a file (.bmp or .png), it's totally fine. However, when I 'convert' this bitmap into a .pdf file using PDFsharp, the image becomes blurry! (That is, the image on the pdf page of course.)
I zoom in to 100% when viewing the PDF file in Adobe Reader. Also when I print the PDF file, it is blurry on the paper.
(The image/bitmap contains many text objects - therefore it's really easy to see that it's blurry.)
Here is my code:
Code:
Bitmap bitmap = new Bitmap(this.Width, this.Height);
this.DrawToBitmap(bitmap, new Rectangle(0, 0, bitmap.Width, bitmap.Height));
bitmap.Save(@"C:\test.png");
PdfDocument doc = new PdfDocument();
PdfPage page = new PdfPage();
XImage img = XImage.FromGdiPlusImage(bitmap);
img.Interpolate = false;
doc.Pages.Add(page);
XGraphics xgr = XGraphics.FromPdfPage(doc.Pages[0]);
xgr.DrawImage(img, 0, 0);
doc.Save(@"C:\test.pdf");
doc.Close();
I have already searched on the forum regarding this. Found
viewtopic.php?p=2471#p2471 but didn't help.
Any help please?