Skip to content

Support External Image via URL #109

Closed
@seanwu1105

Description

@seanwu1105

According to the docs, after pdfmake 0.1.67, external image with http or https URL is supported.

I think it would be possible to extract all src from <img /> elements to generate the images field in docDefinition.

const docDefinition = {
  content: [
    {
      // if you reuse the same image in multiple nodes,
      // you should put it to to images dictionary and reference it by name
      image: 'mySuperImage'
    },
    {
      // in browser is supported loading images via url from reference by name in images
      image: 'snow'
    },
  ],

  images: {
    mySuperImage: 'data:image/jpeg;base64,...content...',

    // in browser is supported loading images via url (https or http protocol) (minimal version: 0.1.67)
    snow: 'https://picsum.photos/seed/picsum/200/300'
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions