Picture from URL?

I want to put Pictures on a PDF.
I installed the MBS DynaPDF Plugin.

I can use this code, to place a picture to my PDF:

  dim p as Picture = Bild_Logo
  call pdf.InsertPicture(p, 232, 30, (465/4), (118/4))

No my problem:
The pictures aren’t in the Xojo -App SourceCode. The pictures are on a web server.

How can I add the pictures with an URL to the PDF?

I guess something like:

dim URLToPicture as String = “http://127.0.0.1/pictures/picture1.png

  dim p as Picture.URL = URLToPicture
  call pdf.InsertPicture(p, 232, 30, (465/4), (118/4))

You would need to download the image from the webserver with a HTTPSocket before using it in the PDF.
Save it in Temporary or Application Support.

If there was a way to embed a remote image in the PDF anyone opening it would need to have access to the web.

or use our CURL plugin to download picture.

I have the same problem.

@Tim:
I know how to download the images. But I don’t know, how I can say Xojo: Wait until the download is complete.

HTTPSocket and CURL plugin can run synchronously.
So function returns when download is ready.

The answer is here: https://forum.xojo.com/22982-get-line-1-from-external-file-located-on-internet/0#p193920

Download the image using whatever means (HTTPSocket, curl, etc.) and then use Picture.FromData to convert the downloaded image data into a Xojo Picture object.

e.g.:

Function URLToPicture(URL As String) As Picture
  Dim http As New HTTPSocket
  Dim data As MemoryBlock = http.Get(URL, 5)
  Return Picture.FromData(Data)
End Function