pvginkel / PdfiumViewer

PDF viewer based on Google's PDFium.
Apache License 2.0
967 stars 418 forks source link

Aliasing on Transparent Background #6

Closed iamcarbon closed 9 years ago

iamcarbon commented 9 years ago

Is there a way to force the background color used for aliasing? It looks like text on a transparent background is aliased with the assumption that it will be rendered on black, not white.

Examples:

default (transparent)

pdf-1

when rendered on a black graphics context:

pdf-2

pvginkel commented 9 years ago

Could you make the PDF file available? That would make it a lot easier to solve this issue.

mafshin commented 9 years ago

I have this issue too. It's very annoying. Isn't there anyway to define a default background color and have auto anti-aliasing?

capture

Sample PDF: https://www.dropbox.com/s/4ssmby92rvnyh9u/Sample.pdf?dl=0

..

pvginkel commented 9 years ago

Thanks for the example PDF. That helps a lot. However, at the moment I have very little time to look at this issue. I will pick this up as soon as I can. Thanks for your patience.

pvginkel commented 9 years ago

I've looked at the issue and from what I can gather, the problem is that you're not using the PdfViewer class but rendering directly to a Bitmap or Graphics. I've implemented support for this. The PdfDocument class now has two new Render overloads which both return an Image. The demo application has been extended to call this using the Tools | Render to Bitmaps option. Have a look at the applicable code in MainForm.cs for how to call this.