[Gambas-user] Blurry text when PDF pages are rendered with gb.poppler and displayed with a DocumentView

Benoît Minisini benoit.minisini at gambas-basic.org
Sat Feb 24 13:26:55 CET 2024


Le 24/02/2024 à 13:03, Benoît Minisini a écrit :
> 
> It's because you don't use the same resolution in both projects.
> 
> With gb.poppler, the resolution is explicit.
> 
> With gb.pdf, the resolution is 72 * the value of the Zoom property.
> 
> I will try to add a method in gb.poppler that paint a page on the 
> current painter by choosing the good resolution automatically.
> 
> Regards,
> 
> 
> Regards,
> 

In the last commit, I modified the Render() method so that if you 
specify the width and height arguments, and not the resolution argument, 
the best drawing resolution will be automatically computed.

That way, no need to tackle the problem of conversion between pixels, 
resolution and absolute size anymore!

Here is the modified code in the DV_PDF_POPPLER project:

Public Sub DocumentView1_Draw(Page As Integer, Width As Integer, Height 
As Integer)

   Dim hImage As Image

   hImage = $PDF_Doc[Page].Render(0, 0, Width, Height)
   Paint.DrawImage(hImage, 0, 0)

End

Regards,

-- 
Benoît Minisini.



More information about the User mailing list