I have inserted an Image into a Draw Page using Basic.
This is basically what I did
Code: Select all
Dim Doc As Object
Dim Page As Object
Dim PDF As Object
'pdf postion and size
Dim Point As New com.sun.star.awt.Point
Dim Size As New com.sun.star.awt.Size
Doc = ThisComponent
'First Point on all pages
Point.x = 0
Point.y = 0
'Size of all pages
Size.Width = 21000 'A4
Size.Height = 29700
Page = Doc.DrawPages(0)
Page.Name = "PDF1"
PDF= Doc.createInstance("com.sun.star.drawing.GraphicObjectShape")
PDF.Size = Size
PDF.Position = Point
PDF.GraphicURL = DocPath 'DocPath being the URL of the pdf
Page.add(PDF)
Code: Select all
Page = Doc.Drawpages.GetByName("PDF1") 'This is the only page in the document.
Doc.Drawpages.remove(Page)