Skip to content

bearddan2000/javascript-web-html-cavas-to-pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

javascript-web-html-cavas-to-pdf

Description

A demo of html rendering to pdf. In this demo the entire body of the html page in rendered to a canvas tag then passed to pdf lib. The rendering is basicaly an image so it will be uneditable.

There is some security issue with htmltocanvas, so that html fragments are not rendered. A workaround to this issue is to have a seperate pdf page for each html page then merge the pdfs. Workaround

Another issue in htmltocanvas lib is bootstrap, rendering to a web page is fine but when using htmltocanvas the css is wrong. A workaround to this issue is to customize boostrap by removing the print media type. This was tested for boostrap v3.7 and later v5.3 both should this issue. Remove print media type

Tech stack

  • htmltocanvas
  • jspdf
  • promise

Docker stack

  • httpd:latest

To run

sudo ./install.sh -u

To stop

sudo ./install.sh -d

To see help

sudo ./install.sh -h