rkusa / pdfjs

A Portable Document Format (PDF) generation library targeting both the server- and client-side.
MIT License
774 stars 142 forks source link

Image from URL (Network Image) #273

Closed roshan9419 closed 2 years ago

roshan9419 commented 2 years ago

Does this library support online network images? Like, if we just pass the URL of the image and it loads that.

rkusa commented 2 years ago

Nope, you'll have to fetch the image yourself. Something like:

const logo = await fetch('/logo.png')
  .then(res => res.arrayBuffer())
  .then(res => new pdf.Image(res))
roshan9419 commented 2 years ago

Thanks, bro!