[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DocumentView confusion
[Thread Prev] | [Thread Next]
- Subject: Re: DocumentView confusion
- From: gbWilly <gbWilly@xxxxxxxxxxxxxx>
- Date: Sat, 15 Nov 2025 10:56:55 +0000
- Cc: user@xxxxxxxxxxxxxxxxxxxxxx
On Saturday, November 15th, 2025 at 00:09, Lee <t.lee.davidson@xxxxxxxxx> wrote:
>
> I thought I might investigate this but ......
>
> How in the world does one load a document into DocumentView?
>
Hi Lee,
Create a new project (add gb.poppler), Draw a DocumentView on the form and create a menu named mnuFileOpen, to open the pfd.
The code below should get you started to get the pdf into the DocumentView. Set the DocumentView property ShowPages to true.
----
Private $hPdfFile As PdfDocument
Private $iCurrentIndex As Integer
Public Sub mnuFileOpen_Click()
Dialog.Path = User.Home
If Not Dialog.OpenFile() Then
LoadPdf(Dialog.Path)
Endif
End
Public Sub DocumentView1_MouseWheel()
Debug "FirstVisiblePage: " & DocumentView1.FirstVisiblePage
Debug "FirstVisibleDocument: " & DocumentView1.FirstVisibleDocument
Debug "LastVisiblePage: " & DocumentView1.LastVisiblePage
Debug "LastVisibleDocument: " & DocumentView1.LastVisibleDocument
$iCurrentIndex = DocumentView1.FirstVisibleDocument
IconView1.Selection = [$iCurrentIndex]
Debug "Current page: " & ($iCurrentIndex + 1)
End
Public Sub DocumentView1_Draw(Page As Integer, Width As Integer, Height As Integer)
Paint.DrawImage($hPdfFile[Page].Render(0, 0, Width, Height), 0, 0)
End
Private Sub LoadPdf(PdfPath As String)
Inc Application.Busy
$hPdfFile = New PdfDocument(PdfPath)
$hPdfFile.Antialiasing = True
$hPdfFile.TextAntialiasing = True
DocumentView1.Count = $hPdfFile.Count 'set number of pages
DocumentView1.Column = 1 'set to page width
DocumentView1.Refresh() 'trigger a draw
$iCurrentIndex = 0
Debug "Current page: " & ($iCurrentIndex + 1)
Debug "Total pages: " & $hPdfFile.Count
Dec Application.Busy
End
---
I hope this will get you going.
gbWilly
| Re: DocumentView confusion | gbWilly <gbWilly@xxxxxxxxxxxxxx> |
| Re: DocumentView confusion | Lee <t.lee.davidson@xxxxxxxxx> |
| DocumentView confusion | gbWilly <gbWilly@xxxxxxxxxxxxxx> |
| Re: DocumentView confusion | Lee <t.lee.davidson@xxxxxxxxx> |