Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Support for webp images #36

Open
Prat041192 opened this issue Jul 22, 2020 · 3 comments
Open

Support for webp images #36

Prat041192 opened this issue Jul 22, 2020 · 3 comments

Comments

@Prat041192
Copy link

Prat041192 commented Jul 22, 2020

Hi All,
I have a Feature request to make and looking for the workaround at the moment too.

Issue: Adding png adds to the size of pdf as well as adds to the load time of the webpage.

I'm using jspdf for generating pdf from the visualization (d3 graph and images and text) over the web portal I'm working on. and most of my images are webp images.

Currently, addImage does not support adding Webp images to the pdf as I can see, usually, the websites or web portals use webp images to reduce the load time of the webpage.

It would be nice to have if the library can support and a big help if anyone can help me with the workaround at the moment.
I'm trying this nice library webp-converter may be others have better ideas to share.

Thanks in advance,

@HackbrettXXX
Copy link
Member

The upstream project (https://github.com/MrRio/jsPDF) recently got support for Webp images. We merged the features of this fork into the upstream repository some time ago and yWorks is now co-maintainer of the original project, which is why this repository will soon be archived. MrRio/jsPDF will soon get a new release that will also support Webp images.

@Prat041192
Copy link
Author

@HackbrettXXX , Thanks for getting back on this. When is the next release planned? and is there any suggestion by which I can reduce the size of the pdf. I've lot of tags and logos that combine together in the pdf that needs to export.

@HackbrettXXX
Copy link
Member

There is no fixed release date, yet. Probably within the next weeks.

You can turn on by passing compress: true to the jsPDF options, but this won't help much if your PDF mainly consists of images. If your images originate from vector graphics, you can add them using svg2pdf. If not, your only option is to compress your images as much as possible. Currently, you can use JPEG images for this. In the future WebP. Note, though, that WebP is also converted to JPEG internally. AFAIK, the PDF standard does not support WebP image de-/encoding.

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

No branches or pull requests

2 participants