Document View - How do you add documents?

Ask about the individual Gambas components here.
Post Reply
User avatar
Posts: 133
Joined: Sunday 25th June 2017 12:14am
Location: Western Australia

Document View - How do you add documents?

Post by Quincunxian » Monday 30th November 2020 10:51pm

It will be simple and obvious but for the moment it's eluding me !

How do you add a document to the view?
I can set 'blank' documents or placeholders for them by setting the count parameter,
but can't find a process to load or add a document.
Cheers - Quin.
I code therefore I am

Posts: 99
Joined: Wednesday 05th April 2017 6:07pm
Location: European Union

Re: Document View - How do you add documents?

Post by vuott » Tuesday 01st December 2020 5:42am

...beginning with this simple code (you have to activate gb.poppler Component):
Private DocumentView1 As DocumentView
Private doc As PdfDocument

Public Sub Form_Open()

  With Me
    .Height = Desktop.H
    .Width = Desktop.W
    .Arrangement = Arrange.Vertical
  End With

  doc = New PdfDocument("/path/of/document.pdf")
  With DocumentView1 = New DocumentView(Me) As "DocumentView1"
    .Column = 1
    .Count = doc.Count
    .Expand = True
  End With


Public Sub DocumentView1_Draw(Page As Integer, Width As Integer, Height As Integer)

  Paint.DrawImage(doc[Page].Render(0, 0, Width, Height, 0, doc.Resolution * 2), 0, 0, Paint.Width, Paint.Height)
Amare memorentes atque deflentes ad mortem silenter labimur.

Post Reply