Page 1 of 1

Document View - How do you add documents?

Posted: Monday 30th November 2020 10:51pm
by Quincunxian
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.

Re: Document View - How do you add documents?

Posted: Tuesday 1st December 2020 5:42am
by vuott
...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

End


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)
   
End