PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.de/

XGraphics.DrawImage lowers image quality (PdfSharp-WPF)
http://forum.pdfsharp.de/viewtopic.php?f=2&t=1534
Page 1 of 1

Author:  fullwipe [ Tue Feb 08, 2011 12:14 am ]
Post subject:  XGraphics.DrawImage lowers image quality (PdfSharp-WPF)

Hello!
I'm trying to draw an image on pdf page (bitmap, which is created through rendering wpf visuals (Geometries) with RenderTargetBitmap.Render). Bitmap has a huge resolution (3000*4000 or something like that). But in pdf strange gray shadows (lines) appear around my shapes and in general the image looks worse than bitmap original. I'm saving bitmap as png/jpg file before rendering it to pdf page, so I can show you the difference (attached screenshots, look at that weird gray vertical line). It seems that the pixels are not snapped in pdf or maybe it's because the pdf engine converts bitmap with huge losses before saving it in pdfpage ... I would just like to know the reason of this behaviour and possible workarounds on it.

Assembly: PdfSharp-WPF.dll (v1.31.1789.0, but also tried with v1.30).
Thank you in advance, sorry for my english)

Attachments:
pdf.png
pdf.png [ 71.87 KiB | Viewed 8951 times ]
image.png
image.png [ 45.18 KiB | Viewed 8951 times ]
code.png
code.png [ 8.28 KiB | Viewed 8951 times ]

Author:  Thomas Hoevel [ Tue Feb 08, 2011 2:04 pm ]
Post subject:  Re: XGraphics.DrawImage lowers image quality (PdfSharp-WPF)

Hi!

I hope this post helps:
viewtopic.php?p=2471#p2471

Author:  fullwipe [ Thu Feb 10, 2011 9:38 am ]
Post subject:  Re: XGraphics.DrawImage lowers image quality (PdfSharp-WPF)

Thanks for quick answer, but unfortunately it didn't help. Still there are strange dark-gray contour lines after saving to pdf.

Author:  Thomas Hoevel [ Thu Feb 10, 2011 9:45 am ]
Post subject:  Re: XGraphics.DrawImage lowers image quality (PdfSharp-WPF)

fullwipe wrote:
but unfortunately it didn't help

What did you try?

Did you turn smoothing off in the display options of the Adobe Reader?

PDFsharp imports images unmodified into PDF files.

Author:  fullwipe [ Thu Feb 10, 2011 1:55 pm ]
Post subject:  Re: XGraphics.DrawImage lowers image quality (PdfSharp-WPF)

I've tried to set
ximage.Interpolate = false;
before
gfx.DrawImage(ximage, contentRect);

Now I tried to turn off all smoothing options in Adobe Reader, but nothing changed.
Can it happen because of the image dpi or drawing image scaled to contentRect?
Image dpi is pretty high (288), but adobe reader dpi is 110.

Attachments:
screen.png
screen.png [ 53.38 KiB | Viewed 8928 times ]

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/