viewing PDF
Posted
#1
(In Topic #1815)
Enthusiast

PDF in documentview with zoom
Dear all,after seeking and trying some methods for viewing PDF Files I went back to the
deprecated gb.PDF component.
It is short, simple and does what one could expect from a PDF viewer.
A look at the software farm was not successful, maybe there is something
I couldn't find - is there a search function?
On the other hand, I am interested in how the problem can be solved with
the newer gb.poppler component.
Has anyone done something like this before or knows where to find something?
Thanks and best regards
Yogi
Posted
Administrator

I did create pdfs using gb.cairo, but that is a whole other matter.
I guess you will need to look into https://gambaswiki.org/wiki/comp/gb.poppler/pdfdocument for viewing.
I couldn't find much on the topic either except for some on the Italian forum:
- https://www.gambas-it.org/wiki/index.php/Estrarre_il_testo_da_un_file_PDF_con_le_risorse_del_Componente_gb.poppler
- https://www.gambas-it.org/wiki/index.php/Stampare_un_file_PDF
I guess you could use a translator and see if it get's you anywhere.
Good luck and keep us posted. I happilly think along
Edit: Forget all above, I found this on the farm from gianluigi

That should provide some answers
On the farm I selected All software, next clicked on radiobutton Show Filters and put gb.poppler in Filter to find above
Last edit: by gbWilly
gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
Posted
Enthusiast

k23:k23.12:k23.12.5:start [GAMBAS BOOK 3.19.5]
The lesson starts here:
k23:k23.12:start [GAMBAS BOOK 3.19.5]
Posted
Administrator

I totally forgot about gambas-buch.Gianluigi said
You can find a more detailed project here:
k23:k23.12:k23.12.5:start [GAMBAS BOOK 3.19.5]
The lesson starts here:
k23:k23.12:start [GAMBAS BOOK 3.19.5]
From “Post #12,392”, October 9th 2025, 6:15 PM
gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
Posted
Enthusiast

gbWilly said
I would like to help but I never had the need for a pdf viewer or anything of the kind.
From “Post #12,388”, October 9th 2025, 3:55 PM
Dear Willy,
Every help is very much appreciated.
Actually I learn with the m3u project how to do it with Gambas. First it was just creating and editing
m3u Files (yes, even VLC can handle m3u files 😀). But learning by doing is the best way for me
and also putting some ideas in the project. Now I'm also extending the project with an mp3 player -
there are plenty of it.
But back to the topic, one idea was to give a little help by opening a PDF file.
Not everyone has good eyesight; I wear glasses myself, so I simply wanted
to incorporate a zoom feature. That worked out great with the gb.PDF
Let's see how it works out with the poppler PDF component.
Regarding the software farm, I didn't understand the filter thing, thanks for pointing that out!
The older you get, the more you expect things to work a certain way.
I was looking for the term or symbol “search” or “find.”
At the moment first I look in the mentioned Gambas Book. If I don't find in short time what
I'm looking for next is the forum, then startpage.com. Doesn't mean that the info I'm looking
for is not in the book, just not finding it.
Next is getting to the community 😇
Thanks a lot and
kind regards,
Yogi
Posted
Enthusiast

Gianluigi said
You can find a more detailed project here:
k23:k23.12:k23.12.5:start [GAMBAS BOOK 3.19.5]
The lesson starts here:
k23:k23.12:start [GAMBAS BOOK 3.19.5]
![]()
From “Post #12,392”, October 9th 2025, 6:15 PM
Thanks for pointing me there, I'll have a look;
Kind regards,
Yogi
Posted
Enthusiast

gbWilly said
I totally forgot about gambas-buch.Gianluigi said
You can find a more detailed project here:
k23:k23.12:k23.12.5:start [GAMBAS BOOK 3.19.5]
The lesson starts here:
k23:k23.12:start [GAMBAS BOOK 3.19.5]
From “Post #12,392”, October 9th 2025, 6:15 PM![]()
Yogi -> it's originally in German, even better for you
![]()
From “Post #12,394”, October 9th 2025, 6:25 PM
I downloaded it some time ago. I prefer the German language, but English has always been
the main language for programming.
Greetings to the Netherlands (or even Holland 😀)
Kind Regards
Yogi
Posted
Enthusiast

First I had a look at
and played around,Gianluigi said
DocumentViewPDFZoomDialog
at the first sight it worked with zooming in. So of course I can use this as a sample.
Next I found out that there is no zoomOut there, ok, copied the sub for zooming in …
to
and had a try. Zooming in worked, zoomig out worked - but this doesn't work as expected,
the PDF becomes somehow clipped.
OK, next step. Downloading the PDF-Reader from Gambas Book PDF Reader from Gambas Book
There I found out, that there is some difference which version of Gambas you are using for rendering the page
in
Here is this peace of code:
Code (gambas)
'-- My standard for rendering method in V3.19.0 after a few bug fixes in gb.poppler
If System.FullVersion = "3.19.0" Then
'-- 150 dpi provides a better quality in the DocumentView but slower
Paint.DrawImage(hPdfDocument[Page].Render(,,,,, 150), 0, 0, width, height)
Else If System.FullVersion >= "3.19.1" Then
'-- Refer to Mailing List email of Benoît Minisini in the 'Notes' file in the project directory
'-- https://lists.gambas-basic.org/pipermail/user/2024-February/081570.html
'-- Quote: 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.
'-- Automatically choosing the resolution for a good readable result in a DocumentView,
Paint.DrawImage(hPdfDocument[Page].Render(0, 0, Width, Height), 0, 0)
Else
Message.Error("Gambas 3.19.0 is the minimum version for a reasonable use of gb.poppler")
Endif
If System.FullVersion = "3.19.0" Then
'-- 150 dpi provides a better quality in the DocumentView but slower
Paint.DrawImage(hPdfDocument[Page].Render(,,,,, 150), 0, 0, width, height)
Else If System.FullVersion >= "3.19.1" Then
'-- Refer to Mailing List email of Benoît Minisini in the 'Notes' file in the project directory
'-- https://lists.gambas-basic.org/pipermail/user/2024-February/081570.html
'-- Quote: 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.
'-- Automatically choosing the resolution for a good readable result in a DocumentView,
Paint.DrawImage(hPdfDocument[Page].Render(0, 0, Width, Height), 0, 0)
Else
Message.Error("Gambas 3.19.0 is the minimum version for a reasonable use of gb.poppler")
Endif
As I am on Gambas 3.20.4 copied just the one line, changed the variable and voila,
now it works in both directions zooming in & out.
So we are ready for dropping gb.pdf
Have a nice weekend,
Kind regards,
Yogi
Posted
Enthusiast

Since we're talking about Zoom, I also wanted to point out this page:
Codice essenziale per mostrare un file PDF con le risorse del Componente gb.poppler - Gambas-it.org - Wikipedia
Posted
Administrator

Gianluigi said
Since we're talking about Zoom, I also wanted to point out this page:
Codice essenziale per mostrare un file PDF con le risorse del Componente gb.poppler - Gambas-it.org - Wikipedia
From “Post #12,425”, October 11th 2025, 10:51 AM
Been looking at the code in above link and it's actually quite easy to create a pdfviewer
A lot easier that creating a pdf using gb.cairo
I might be adding this as an GUI application to build in Book 2 I'm writing.
It is a very practical application to have on a system and a good example to use for demonstrating 'stuff'…
I see some educational value in it
gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
Posted
Enthusiast

The PDF viewing is already good to use.
I'm just curious about one thing:
it is possible with the mouse wheel to scroll the page up and down.
Especially if one zooms in this is a good thing.
How to do that scrolling with the up and down key?
Tried some things, looked also at the Italian site
Looked into the classes (poppler, scroll) but nothing what I could find out.
Something like
Code (gambas)
$hPdf.scrolly(100)
$hPdf.scrolly(-100)
$hPdf.scrolly(-100)
here the code for keypress:
Code (gambas)
Any ideas?
Thanks a lot &
kind regards
Yogi
Posted
Enthusiast

To achieve what you want, I think you'll also need to create the index.
Unfortunately, I don't have much time to devote to Gambas these days. If you haven't solved the problem in the meantime, I'll send you some code.
Sorry.
Posted
Enthusiast

Code
Public Sub Form_KeyPress()
Dim i As Integer = Val(ListViewPages.Current.Key)
If Key.Code = Key.PageDown Then
Try ListViewPages[i + 1].Selected = True
Endif
If Key.Code = Key.PageUp Then
Try ListViewPages[i - 1].Selected = True
Endif
End
Posted
Enthusiast

Gianluigi said
I forgot, this works in Claus's code:But I think it would be better to use arrows for possible future additionsCode
Public Sub Form_KeyPress()
Dim i As Integer = Val(ListViewPages.Current.Key)
If Key.Code = Key.PageDown Then
Try ListViewPages[i + 1].Selected = True
Endif
If Key.Code = Key.PageUp Then
Try ListViewPages[i - 1].Selected = True
Endif
End
From “Post #12,450”, October 14th 2025, 8:14 AM
Dear
Thank you again for your effort.
I tried out your sample but could not make it running. Unknown ListViewPages…
For the handling I used the PgUp/PgDn keys for showing previous/next PDF pages which
is already working.
The scrolling part with the arrow up/Down keys I have no clue how to scroll the pdf just
like the mouse wheel,
Kind regards,
Yogi
Posted
Enthusiast

I meant something like this.
See the attached project, which is a "reduction" of the one in the lesson.
pdf-reader-g-0.0.1.tar.gz
Posted
Administrator

Gianluigi said
Dear Yogi (explain to me how to enter your name like you did mine)
I meant something like this.
See the attached project, which is a "reduction" of the one in the lesson.
![]()
It's very simple.
@Gianluigi
Posted
Enthusiast

Gianluigi said
Dear Yogi (explain to me how to enter your name like you did mine)
I meant something like this.
See the attached project, which is a "reduction" of the one in the lesson.
From “Post #12,452”, October 14th 2025, 5:38 PM
Good morning,
Yes, it is that simple, just using the "@" and a few characters and the system - as it is supported by most
of the chat systems - will give you a hint which person to address.
Thanks again for your help,
Have a nice day,
Regards,
Yogi
Posted
Enthusiast

I may not have explained very well what I wanted to achieve.
Here is a short video with the standard viewer in Ubuntu, where it works with both
the mouse wheels and the up/down keys in the same way.
In Gambas, it works with the mouse without any additional actions, but doesn't with they down/up keys.
pdfreader720.mp4
The jumping forward/backward one page is working already and I'm happy with it.
Just this detail with smooth scrolling with the Down/Up keys…
Thanks again,
Regards,
Yogi
Posted
Administrator

All that is missing is the "Your code here" part to make it work.
Good luck
P.S. The "'' is a single quote for comment but the code editor seems to like to replace it for some reason with '
gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
Posted
Enthusiast

As suggested by
Codice essenziale per mostrare un file PDF con le risorse del Componente gb.poppler - Gambas-it.org - Wikipedia
I'm attaching an example.
PdfScroll-0.0.1.tar.gz
Posted
Enthusiast

gbWilly said
I guess you will have to code the Key.Up and Key.Down to make that work
All that is missing is the "Your code here" part to make it work.
Good luck
P.S. The "'' is a single quote for comment but the code editor seems to like to replace it for some reason with '
From “Post #12,464”, October 15th 2025, 8:15 AM
Hi Willy,
Yes, that is the point
Regards
Yogi
Posted
Enthusiast

Gianluigi said
DearYogi
As suggested bygbWilly I'd already pointed you to this lesson written by Vuott on the Italian wiki:
Codice essenziale per mostrare un file PDF con le risorse del Componente gb.poppler - Gambas-it.org - Wikipedia
I'm attaching an example.From “Post #12,467”, October 15th 2025, 9:06 AM
Dear
I had already a look at this website Wiki and I am more confused than before.
I thought I can have the documentview container to get it work. After the Italian Wiki I had no idea
because of the different containers used for showing the PDF.
Now I think I quit, just had my "working" code tested with the PDF provided by the samples for download with
different page sizes, and what - my code doesn't work as expected. If all is size A4 no problem, but if mixed up…
Anyway, if someone is interested in the sample I did:
PDF_Documentview-0.0.1.tar.gz
Kind regards,
Yogi
Posted
Enthusiast

you need to get a little familiar with Gambas containers.
If you wanted to do this, see what I changed and practice.
PDF_Documentview-0.0.2.tar.gz
Posted
Enthusiast

Gianluigi said
DearYogi ,
you need to get a little familiar with Gambas containers.
If you wanted to do this, see what I changed and practice.![]()
![]()
From “Post #12,471”, October 15th 2025, 11:38 AM
Dear
Thank you for giving a lesson in arranging the container in a form. Much appreciated because I did the last
time a view to resize automatically the objects and container on a form without using the sourcecode.
Not that easy if your are not aware of the actions done by arrange, expand, resize etc.
But 😂 it doesn't change anything to my problem regarding scrolling and viewing the PDF Files.
Anyway, thanks a lot!
Kind regards,
Yogi
Posted
Enthusiast

But 😂 it doesn't change anything to my problem regarding scrolling and viewing the PDF Files. Anyway, thanks a lot! said
Dear
We were suggesting this (see attached project).
Good night.
PDFscroll-0.0.1.tar.gz
1 guest and 0 members have just viewed this.



