[Gambas-user] Poppler PDF fitting in DocumentView
rwe-sse at osnanet.de
Wed Jan 12 08:55:16 CET 2022
I have questions about the poppler library way of doing things.
Some time ago I got some code examples from Gianluigi, and now I tried
one of them which seemed to be practical for me.
In a DocumentView a PDF shall be shown.
I think the answer lies in this SUB:
Public Sub DocumentView1_Draw(Page As Integer, Width As Integer, Height
Dim fRes As Float
Dim himg As Image
fRes = $hPdf.Resolution / 72
himg = $hPdf[Page].Render(0, 0, Width / fRes, Height / fRes, 0,
$hPdf.Resolution / fRes)
Draw.Image(himg, 0, 0, Width, Height)
Where do I have to tweak these lines to fit the pages into the area of
Another trial was tweaking the Zoom function:
Public Sub btnZoomIn_Click()
Dim f As Float = DocumentView1.Zoom
f = f / 2
'f += 0.05
'If f > 1.5 Then f = 1
DocumentView1.Zoom = f
DocumentView1.Count = $hPdf.Count
But this will just cut the areo on which the PDF is shown by half, the
document is shown by half and becomes unsharp. Ok, now it fits, but this
is not really the desired effect.
I add the code archive for those who want to test it.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 12920 bytes
Desc: not available
More information about the User