Let’s open a new Draw document with our website logo at its original size.
In the example, replace value of props(0).Value with the URL of your graphic file.
Sub AddGraphicShape()
Dim oDoc As Object, oPage As Object, oShape As Object
Dim oGraphic As Object, oDisp As Object
Dim props(0) As New com.sun.star.beans.PropertyValue
oDoc = StarDesktop.LoadComponentFromUrl("private:factory/sdraw", "_default", 0, Array())
oPage = oDoc.DrawPages.getByIndex(0)
oShape = oDoc.createInstance("com.sun.star.drawing.GraphicObjectShape")
props(0).Name = "URL"
props(0).Value = "https://ask.libreoffice.org/uploads/asklibo/original/1X/1eec1ce28d4605f25e751aea59dbef2bc0782151.png"
oShape.Graphic = CreateUnoService("com.sun.star.graphic.GraphicProvider").queryGraphic(props)
oPage.add(oShape)
' To original size
oDisp = createUnoService("com.sun.star.frame.DispatchHelper")
oDoc.CurrentController.Select oDoc.DrawPages.getByIndex(0).getByIndex(0) ' select shape
oDisp.executeDispatch oDoc.CurrentController.Frame, ".uno:OriginalSize", "", 0, Array()
End Sub