Comments (3)
I've just published v1.0.3 with <img>
support .... However you have to provide a base64 encoded content for the image, as explained in the README and as demo'ed in the example.js file
from html-to-pdfmake.
Yes I could add it someday!
from html-to-pdfmake.
We might be able to use an URL to a image, rather than the base64 representation, if CORS let's us.
Back in OpenSlides 2(.1 I believe), we used to develop a dynamic solution for images that did not require a direct base64 string. Converting it to OpenSlides 3 is still on my roadmap, but here is how we used to do it:
- pre-scan the HTML document for image-tags and save the sources (as seen here)
- we imply images are an absolute URL. CORS is really a topic here, so don't expect external sources to work just fine.
- That allows you to handle duplicated images pretty well
- convert the whole list to base64 (as seen here)
- The base64 string will be generated using
Image
-Objects andcanvas
, as seen here
- The base64 string will be generated using
In the end we have a list of URL-to-Base64 pairs.
{
url-to-image1: base64-of-image1,
}
We then used that to generate the HTML document, that's more-or-less how you are already doing it already, as seen here
As you can see, this was another era of JavaScript. Using async await
functions and Promise.all
this code could probably be cleaned up a whole lot
from html-to-pdfmake.
Related Issues (20)
- Support for header / footer HOT 4
- Table cell organization bug HOT 3
- Freeze bug HOT 4
- Adding extra white space in pdf. HOT 8
- Cannot size an image HOT 10
- img breaks line HOT 1
- lineHeight property handling HOT 5
- Feature request: handle and support invalid image HOT 1
- Issue with list items not rendering HOT 3
- Feature Request: HOT 2
- line-height issue HOT 3
- Bug: Table widths parsing issue HOT 2
- Dynamic table widths update HOT 11
- ErrorHandler: TypeError: cellWidth.replace is not a function at index.js:385:105 HOT 5
- Copying and pasting the text "finally" from the PDF and the letter "i" is not included when pasted HOT 1
- Bug: Newlines get inserted after images where they actually shouldn't be HOT 1
- Adding Extra Space in-between HOT 4
- rgba colors parsed incorrectly HOT 1
- I want to load HTML content on top and image information below of that HOT 4
- React native HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html-to-pdfmake.