[Gambas-user] Blurry text when PDF pages are rendered with gb.poppler and displayed with a DocumentView
Claus Dietrich
claus.dietrich at freenet.de
Fri Feb 2 19:36:15 CET 2024
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? To get the same dimensions as
obtained with gb.pdf I had to change the resolution property of the
PDFDocument to 81.4 dpi (gb.pdf doesn't offer this property). But to my
surprise even with that higher resolution the displayed result in the
DocumentView was blurry. How can this happen?
Rendering with gb.pdf is our benchmark because the sharpness of the
displayed pages is comparable with those of the document reader Xreader.
Where is the mistake?
Best regards
Claus
More information about the User
mailing list