Node-html-pdf: Render HTML with a script on the page

Created on 4 Jun 2018  路  1Comment  路  Source: marcbachmann/node-html-pdf

Hey people.

I am using this package to print a report that contains a barcode on the layout. The problem is that when I run the pdf generator, it not seens like running the source script on the page. Here the html code:

<svg id="barcode"></svg>
<script src="./JsBarcode.all.min.js"></script>
<script>JsBarcode("#barcode", "671860013624", {height: 50, width: 1, fontSize: 15});</script>

Opening the page on the browser, everything is fine.
Does anyone knows if the package should run the HTML script? Or just renders what is common HTML and CSS ?

@EDIT
I saw in the documentation the option 'base', that should be the path to the imported files (css, js) but it seems not working and I didn麓s found any example.

Most helpful comment

After a lot of attempts, I got it usint the 'base' option property.
To configure the path of imports, follow the example:
base : 'file:///home/.../yourPath/public',
The problem is that you need to setup all the path.
To import, you consider the global scope of the path. Example:
<link rel="stylesheet" type="text/css" href="./public/style.css">

>All comments

After a lot of attempts, I got it usint the 'base' option property.
To configure the path of imports, follow the example:
base : 'file:///home/.../yourPath/public',
The problem is that you need to setup all the path.
To import, you consider the global scope of the path. Example:
<link rel="stylesheet" type="text/css" href="./public/style.css">

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mortuie picture Mortuie  路  4Comments

tashikomaaa picture tashikomaaa  路  5Comments

sca88 picture sca88  路  4Comments

vivekiyer114 picture vivekiyer114  路  5Comments

B-StS picture B-StS  路  5Comments