[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 3 14:33:24 CET 2024
Le 02/02/2024 à 19:36, Claus Dietrich a écrit :
> While exploring gb.poppler classes for a new Gambas Buch chapter and
> after a comparison with the old gb.pdf component, we noticed that the
> rendering of pdf documents with the
> PdfDocument class of gb.poppler delivers images with a noticeably blurry
> text when displayed in a DocumentView. This is what we did:
>
> Rendering with gb.pdf:
>
> Public Sub DocumentView1_Draw(Page As Integer, Width As Integer, Height
> As Integer)
> Paint.DrawImage(hPDFDoc[Page + 1].Image, 0, 0, Width, Height)
> End
> For an A4 page this delivers an image with the dimensions w=673 and h=952.
>
> Rendering with gb.poppler:
>
> Public Sub DocumentView1_Draw(Page As Integer, Width As Integer, Height
> As Integer)
> Paint.DrawImage(hPDFDoc[Page].Render(), 0, 0, width, height)
> End
> For an A4 page this delivers an image with the dimensionsw=595 and h=842.
>
> The dimensions delivered with gb.poppler seem to be correct because
> 210/25.4*72 = 595. However, why 72dpi?
No idea, this is what the poppler API returns.
If you don't specify a resolution in the Render() method, the resolution
stored in PdfDocument.Resolution will be used. Try with 300 dpi, it will
be less blurry.
Regards,
--
Benoît Minisini.
More information about the User
mailing list