Create image from URL in Go SDK

Product: github.com/pdftron/pdftron-go/v2

Please give a brief summary of your issue:
I can create an image from url with this code in Nodejs

const image = await PDFNet.Image.createFromURL(doc, url);

How can I do the same in Go? I can’t seem to find a function to create an image from url.
https://pkg.go.dev/github.com/pdftron/pdftron-go/v2@v2.3.3#Image

1 Like

Hello, I’m AiRon, an automated tech support bot :robot:
While you wait for one of our customer support representatives, I can help you with your question.


In the Go SDK for Apryse, the Image.createFromURL function you are familiar with in Node.js is not directly available. However, you can accomplish this by fetching the image data from the URL and then using the Image.Create method with a byte stream.

Some things you can try:

  • Use an HTTP client in Go to fetch the image data from the URL.

  • Convert the fetched data into a byte stream.

  • Use the Image.Create method from the PDFNet library to create the image from the byte stream.




Here are some resources that might help you:



Hopefully, this helps you solve your problem while you wait for a human to get back to you.

1 Like

The PDFNet SDK Go API does not have a corresponding createFromURL function. You will need to download the file manually and then create the image.

1 Like