Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This works in PDFmake playgroud. But not in NodeJs code level. #2664

Closed
Ananyakokala opened this issue Dec 14, 2023 · 3 comments
Closed

This works in PDFmake playgroud. But not in NodeJs code level. #2664

Ananyakokala opened this issue Dec 14, 2023 · 3 comments

Comments

@Ananyakokala
Copy link

Ananyakokala commented Dec 14, 2023

var dd = {
  content: [
    {
      image: 'snow'
    }
  ],
  images: {
    snow: 'https://<url>/image.png'
  }
};

Receiving the below error:

Invalid image: Error: ENOENT: no such file or directory, open 'https://<url>/image.png'
Images dictionary should contain dataURL entries (or local file paths in node.js)

The same documetDefination works fine in PlayGround But it wont work in my application. The same docDefination what my code dynamically generates will work in playground but from the npm package createPdfKitDocument function gives the above metioned error.
Node Version: >= 16.4
PDFMake Version: 0.2.7

Can any one please help?

@liborm85
Copy link
Collaborator

Loading images from https/http is supported only in browser.

@Ananyakokala
Copy link
Author

@liborm85
Do you mean from pdfMake npm package we will not be able to handle images with http/https URLs?

Here I am using pdfMake to create any PDF and send it as a REST API response to the web application. I am not able to handle it with the above-provided syntax. I need to handle the images in the PDF.

@liborm85
Copy link
Collaborator

See documentation, only in browser:
image

Loading from https/http will be supported in the upcoming 0.3.0 version, #2375.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants