html-pdf-node's People
Forkers
willstenhouse deshanm davidbooth mindinsky fredericocurti bunnygarg11 kyapwc aleem-ahmed-contributions vidrepar vinaya-thimmappa amit-learningmate anantasak-pcru adam-skalicky devxbr giorgiolucca kevinmartin33 piyushverma001 pupun97 martofeld hajer-mrabet nguyendung17 etahoon dlandry-siesde alejandromilan hilallucky manashmandal rrthomas rodrigoieh gustavoasplan flying-samurai paulgrieselhuber aik4dom brunoguschagas flaviolacer ghoshpushpendu saltcorn brave-liu rrichardson oliverliangx kkuisma gordlea fabiomanz mby12 hundres272 jaysonmulwa takso-engineering victorx98 tweikiang ybrodsky windastella grasspelt jamiemcconnell aesbetancourt cmdpeony generalui semproms-64 zerone-ms rafsanamin nekooei xinhaoxx pranavms13 nasirwar yghanem bumping-app eramosr22 tefanhhh saemhco liv1n9 anderson-hincapie-3c typlox deepak-mahajan-30093474 theooog r0bson oussamabenkortbi vbeffa pawletz ashwin-parihar thiagoprimitivo viettel-cloud-calculator j0hnw0rk3r otlichnyy davebrewer nihl999 vinipreisner b010 radosdaniel srdjanrist almoshammer danielhett sahilnare bsuro10 pknuth darshanbib knightcandy andrisgauracs m3sca khanetw duydatpham cityfurniture joe-smalleyhtml-pdf-node's Issues
How to generate multiple pdf's using html-pdf-node
I need to create html to pdf for multiple contents and for that I am using html-pdf-node. Here is my code
let files = [
{ url: "<h1>Welcome to html-pdf-node</h1>", name: 'example.pdf' },
{ url: "<h1>Welcome to html-pdf-node</h1>", name: 'example.pdf' }
]
let options = { format: 'A4', path: 'mypdffile.pdf' };
const d = await htmlToPdf.generatePdfs(files, options)
It creates the pdf but only single file with the name mypdffile.pdf
. But I need all the pdf inside a folder. I am not able to find the way. Pls help
Add extra headers to the 'url' to be fetched
- If possible, would be nice to expose the html-pdf-node API to accept extra puppeteer headers for the request
Error: Failed to launch the browser process!
Encountered this issue on Google Cloud Run.
Here I have a Node application in which HTML needs to be converted into PDF.
2020-08-17 19:34:24.291 IST(node:23) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
2020-08-17 19:34:24.291 IST/usr/src/app/node_modules/puppeteer/.local-chromium/linux-782078/chrome-linux/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory
2020-08-17 19:34:24.291 IST
2020-08-17 19:34:24.291 IST
2020-08-17 19:34:24.291 ISTTROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
2020-08-17 19:34:24.291 IST
2020-08-17 19:34:24.291 IST at onClose (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
2020-08-17 19:34:24.291 IST at ChildProcess.<anonymous> (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:184:79)
2020-08-17 19:34:24.291 IST at ChildProcess.emit (events.js:327:22)
2020-08-17 19:34:24.291 IST at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
Can not create PDF while building with Docker
The PDF is getting generated while running the server on local machine.
But when deploying to docker ( ecs Fargate ) it can not create PDF with error Error: Failed to launch the browser process!
Could not find browser revision 818858. Run "PUPPETEER_PRODUCT=firefox npm install" or "PUPPETEER_PRODUCT=firefox yarn install" to download a supported Firefox browser binary.
Hi, I saw a similar issue that was closed, but unfortunately this issue still persists.
I get this error on a Linux Azure App service, but it was working perfectly until recently. Installing google chrome manually and setting the puppeteer executable path also does not fix the issue as suggested in issue #9.
Can this possibly be investigated?
Returned pdf is corrupted
I am using it with loop back. My Remoting method is as follows:
Visitor.getVisitorsPDF = function (res, dateInStart, dateInEnd, employeeSiteId, name, visitorCompany, employeeName, typeId, shift, cb) {
Visitor.app.models.user.testAccess(res).then((current) => {
let dStart = new Date(dateInStart).getTime();
let dEnd = new Date(dateInEnd).getTime();
dateInStart = new Date(dateInStart).getTime() - 60000000;
dateInEnd = new Date(dateInEnd).getTime() + 60000000;
res.set('Content-Type', 'application/octet-stream');
res.set('Content-Disposition', 'attachment;filename="visitors.pdf"');
let query = { where: { and: [{ timeIn: { gte: dStart, lt: dEnd } }] } };
if (employeeSiteId) {
query.where.and.push({ siteId: Number(employeeSiteId) });
}
if (typeId !== -1) {
query.where.and.push({ typeId });
}
if (current.accountId != SUPER_USER) {
query.where.accountId = current.accountId;
}
Visitor._getVisitors(query, current).then(
(visitors) => {
let visitorsFiltered = visitors.filter((v) => {
if (!v.tztimeIn) return v;
let d = v.timeIn + v.tztimeIn * 60000;
if (dStart < d && d < dEnd) return v;
});
if (name)
visitorsFiltered = visitorsFiltered.filter((v) => {
if (v.name && v.name.toLowerCase().indexOf(name.toLowerCase()) > -1) return v;
});
if (visitorCompany)
visitorsFiltered = visitorsFiltered.filter((v) => {
if (v.company && v.company.toLowerCase().indexOf(visitorCompany.toLowerCase()) > -1) return v;
});
if (employeeName) {
visitorsFiltered = visitorsFiltered.filter((v) => {
if (v.employeeName && v.employeeName.toLowerCase().indexOf(employeeName.toLowerCase()) > -1) return v;
});
}
visitorsFiltered.shift = shift;
Visitor._getVisitorsPDF(visitorsFiltered).then(
(result) => {
res.send(result);
},
(err) => cb(err),
);
},
(error) => cb(error),
);
});
};
Visitor.remoteMethod('getVisitorsPDF', {
description: 'Get visitors list in PDF file',
accepts: [
{ arg: 'res', type: 'object', http: { source: 'res' } },
{ arg: 'dateInStart', type: 'string' },
{ arg: 'dateInEnd', type: 'string' },
{ arg: 'employeeSiteId', type: 'string' },
{ arg: 'name', type: 'string' },
{ arg: 'visitorCompany', type: 'string' },
{ arg: 'employeeName', type: 'string' },
{ arg: 'typeId', type: 'number' },
{ arg: 'shift', type: 'number' },
],
returns: { arg: 'content', type: 'Buffer' },
http: { path: '/getpdf', verb: 'get' },
});
And pdf method is as follows :
Visitor._getVisitorsPDF = async function (visitors) {
let file = { content: '<h1>Hello wordl</h1>' };
let options = { format: 'A4' };
html_to_pdf.generatePdf(file, options).then((pdfBuffer) => {
console.log('PDF Buffer:-', pdfBuffer);
return pdfBuffer;
});
};
But the returned pdf is corrupted can't load the pdf what is the issue ?
Error whlie working with Ubunut 20.04.2 LTS
HTML to PDF conversion not working with Ubuntu 20.04.2 LTS
We are using Ubuntu 20.04.2 LTS and NodeJS v12.13.1
This function not producing any output or error messages
html_to_pdf.generatePdf
But at the same time this combination works well
Ubuntu 18 and NodeJS v12.13.1
Any help appreciated.
Thanks
Error: connect ECONNREFUSED 127.0.0.1:80
This my code
`
try {
let html = await creator.html(document, options);
//save to file then email it
console.log("try")
let file = { content: html};
console.log(html)
//file = { url: "https://example.com" };
console.log(file)
html_to_pdf.generatePdf(file, options).then(output => {
console.log("PDF Buffer:-", output); // PDF Buffer:- [{url: "https://example.com", name: "example.pdf", buffer: <PDF buffer>}]
});
/*
html_to_pdf.generatePdf(file, options).then(pdfBuffer => {
io.to(res.locals.token).emit("message", data.title + " has been created");
res.header('Content-type', 'application/pdf')
res.send(pdfBuffer)
});*/
} catch (err) {
console.log(err);
io.to(res.locals.token).emit("error", data.title + " error " + err.toString());
debug(req, res, err);
res.json(err.toString())
}
`
and error using file content
node:internal/process/promises:246
triggerUncaughtException(err, true /* fromPromise */);
^
Error: connect ECONNREFUSED 127.0.0.1:80
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1161:16) {
errno: -4078,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 80,
response: undefined
}
[nodemon] app crashed - waiting for file changes before starting...
headTemplate
Excuse me,can I generate a pdf with page header which from second page rather than from first page
Custom fonts not applying on generated PDF file
Hi!
I've got some local fonts and images served from an Express app that's running on localhost:5000.
I'm generating an HTML file to convert it to PDF, that has the CSS where I'm importing the previously mentioned fonts, using the following syntax:
@font-face {
font-family: <font-name>;
src: url('http://localhost:5000/fonts/<font-file-name>.otf');
}
My issue is that the fonts are not being applied to the text of the generated PDF file. On the other hand, all images (served by the same host) are correctly rendering in the generated PDF file.
I would appreciate if someone could point me in some direction to resolve this issue.
PS: I'm currenlty using html-pdf-node v1.0.5
and node v12.18.3
.
Thanks in advance.
Image does not show when generate pdf file
I just have the template:
<div class="imgUrl">
<img src="./bike.png">
</div>
it loads well in HTML file but not when generating to pdf file. Any ideal?
What do the default args do? (Question and not issue)
I wanted to know what the default args "--no-sandbox" and "--disable-setuid-sandbox" do since the description on the docs of those arguments wasnt that clear
Error
I am seeing the following error when using this library. Can someone help?
2020-08-02T13:51:08.989142+00:00 app[web.1]: Error: Failed to launch the browser process!
2020-08-02T13:51:08.989144+00:00 app[web.1]: /app/node_modules/puppeteer/.local-chromium/linux-782078/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
2020-08-02T13:51:08.989145+00:00 app[web.1]:
2020-08-02T13:51:08.989145+00:00 app[web.1]:
2020-08-02T13:51:08.989146+00:00 app[web.1]: TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
2020-08-02T13:51:08.989147+00:00 app[web.1]:
2020-08-02T13:51:08.989147+00:00 app[web.1]: at onClose (/app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
2020-08-02T13:51:08.989148+00:00 app[web.1]: at Interface.helper_js_1.helper.addEventListener (/app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:183:68)
2020-08-02T13:51:08.989148+00:00 app[web.1]: at Interface.emit (events.js:194:15)
2020-08-02T13:51:08.989149+00:00 app[web.1]: at Interface.close (readline.js:397:8)
2020-08-02T13:51:08.989152+00:00 app[web.1]: at Socket.onend (readline.js:173:10)
2020-08-02T13:51:08.989152+00:00 app[web.1]: at Socket.emit (events.js:194:15)
2020-08-02T13:51:08.989153+00:00 app[web.1]: at endReadableNT (_stream_readable.js:1107:12)
2020-08-02T13:51:08.989154+00:00 app[web.1]: at process.internalTickCallback (internal/process/next_tick.js:72:19)
[1] 'Failed to launch the browser process! spawn /home/node/app/node_modules/html-pdf-node/node_modules/puppeteer/.local-chromium/linux-818858/chrome-linux/chrome ENOENT\n\n\nTROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md\n',
I am getting the above mention error while downloading a PDF from node JS
on local machine it is working properly but on server where we are using a docker container there it is giving an issue
please help me out
Loading CSS
Hello
I have a simple html like shown below and trying to figure out how can i load the internal css
`
a | b |
---|---|
1 | 2 |
Pages with different margins
Hello, I have not found how to solve this issue. I need to generate a pdf file with the first cover without margins, and with margins from the second cover. It's possible?
Regards
webpack error
Hello, i have some error in const html_to_pdf = require('html-pdf-node');
TypeError: o is not a function
webpack:
module.exports = { mode: 'production', entry: './make_pdf.js', output: { path: path.resolve(__dirname, 'build'), filename: 'make_pdf_packed.js', }, module: { parser: { javascript: { commonjsMagicComments: true } } }, target: 'node', resolve: { extensions: ['.js', '.jsx', '.ts', '.tsx'], alias: { 'handlebars/runtime': 'handlebars/dist/cjs/handlebars.runtime', 'handlebars': 'handlebars/dist/cjs/handlebars.runtime', 'coffee-script': 'coffeescript', 'formidable': 'formidable/src' } }, externalsPresets: { node: true // in order to ignore built-in modules like path, fs, etc. }, optimization: { minimize: true }, };
LastPageHeight automatically crop to texthight
Error: Protocol error (Page.printToPDF): Printing failed
I found the issue, it is related to chrome option i.e. headless and you did not implement/add this option
puppeteer.launch({
args: ["--no-sandbox", '--disable-setuid-sandbox'],
headless: true
});
Page margin option not working
var html_to_pdf = require('html-pdf-node'); html_to_pdf.generatePdf({content: html}, { path: 'out1.pdf', margin: { top: "150px", bottom: "150px", right: "0px", left: "0px", }, format: 'a4', }).then(pdfBuffer => { console.log("PDF Buffer:-", pdfBuffer); });
I used the above code. For some reason, margin options are not working. If I use URL instead of content, then it's working. Kindly assist me with the issue. If I try to insert header or footer, the html content is overlapping them. Attached the screenshot of pdf for reference.
Issue with style tags in html
It works fine if there is inline css in html but it fails in cases where <style> tags are present in html
PDF file does not generate on live server. Works in dev.
I'm not sure what is happening here:
html_to_pdf.generatePdf(file, options).then(pdfBuffer => {
console.log("PDF Buffer:-", pdfBuffer)
})
This works in dev and the file is generated correctly into the correct file path.
However it does not work on the live server. Any suggestions please?
footerTemplate usage
Hi!
First of all thanks a lot for this library, it's saving me right now.
Just have a small question... I want to add some text in the footer part of the pdf but I haven't managed to set it right, you write that it should be valid html that contains some said classes, so far I have:
<div class="title" style="text-align: justify; text-justify: inter-word;">
<p> My footer long text </p>
</div>
<span class="date"></span>
<span class="url"></span>
<span class="pageNumber"></span>
<span class="totalPages"></span>
let options = { format: 'A4', footerTemplate: footerContent };
let file = { content: content };
html_to_pdf.generatePdf(file, options).then(...
But there's nothing in the footer when I donwload the PDF, is there something I'm doing wrong?
Downloading Chromium during installation
Error creating PDF file in Electron+React App Failed to launch the browser process! spawn
Uncaught Error: Error invoking remote method 'writeDailyScheduleReport': Error: Failed to launch the browser process! spawn
I'm getting this message when the app invokes a process that generates a PDF file through IPC modules.
Here is the sample code that I'm using to generate the report:
This is the method that writes the file, in fact, is the sample code in this repository:
And this are the params that it receive:
Where content is the HTML code of the report.
- I have to mention that the report is generated by the app with no problem in developing mode but I got that error when I build the executable file using electron-builder
- Another important thing is that the program creates a folder where the files will be saved, the folder is created even in production mode but the pdf file not.
- This folder is called "temp" and is created inside "dist".
What I'm doing wrong? (Btw sorry for my bad English I'm still learning )
Add timeout option
Add timeout option to wait n seconds as the web page loads
Add a setting to pick the output format of choice.
- Add a setting to pick the output format of choice., Especially base64 which is one of the more common functions we need our output in
Having problem in linux OS
When I've created the code i've used windows, but my production code is in linux.
How can i create the pdf in linux? because they didnt create any pdf inside my server.
External Fonts Not Being Captured
I've been digging into this issue tonight and believe I have found the source of the issue. I am trying to load external fonts from Google Fonts, and when I preview the html I can see the font is working fine. However, when I print to pdf, the font is not being used. I believe what is happening is that Chromium is printing the page before the font gets loaded and used. I would like to request some sort of option to set where I delay chromium by x seconds to load the page before priting to PDF.
Script tag error issue
if we add script tag and sends some unwanted code like alert("anything")
with the html string then this lib don't resolve or reject the promise. it look like there is no timeout.
Default port 80 causing issues
I was testing this in an express app running on port 3000 and it took me way too long to understand that if the html code links to other files it uses port 80 by default to try and get those files.
it would be really nice if one could specify what port to use for internal links or if the error was more eloquent about it or better yet if it failed gracefully instead of crashing:
node:internal/process/promises:265
triggerUncaughtException(err, true /* fromPromise */);
^
Error: connect ECONNREFUSED 127.0.0.1:80
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16) {
errno: -61,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 80,
response: undefined
}
Puppeteer 10.4.0 is deprecated
Using html-pdf-node 1.0.8, I see:
- Deprecation warning:
npm WARN deprecated [email protected]: Version no longer supported. Upgrade to @latest
- Vulnerability: (npm audit)
html-pdf-node >=1.0.8
Depends on vulnerable versions of inline-css
Depends on vulnerable versions of puppeteer
node_modules/html-pdf-node
options request: autoPageHeight: true, autoPageWidth: true
I'm trying to export a large HTML table to PDF, and I want it to all fit on one page (a 1-page PDF). This library works great, but right now I have to make an educated guess and set a width
and height
big enough to contain the table.
Would it be possible to automatically set the page width and page height to contain the content? For my purposes it would be OK if both were set at once (e.g. autoPageSize
), but it would probably be more generally useful if autoPageHeight
and autoPageWidth
could be set independently. An alternative API option would be to allow width: "auto", height: "auto"
.
Thank you!
Upgrade to Puppeteer 10+
The existing dependency, Puppeteer, doesn't work on ARM64 (Mac M1 platform)
Puppeteer is up to version 10.4.0 now, and 11.0 is about to be released, so maybe it is time to bump up the dependency.
I have tried using a yarn resolution to bump Puppeteer to version 10.4.0, and it at least installs correctly on my M1 Mac.
I will try to enumerate any breaking API changes here.
Add a license
Hey,
you have a great project here and I've used it to great success to create some personal documents in HTML. However, this repository does not contain a software license which makes it problematic to use in any software projects (basically, using your code would mean legal issues due to unclear permissions).
I'd suggest adding a license to make it clear under which terms this library can be used.
For your convenience, I'll be attaching some suggestions for open-source licenses but feel free to use whatever you like. The links provided will have a short summary of the licenses, an overview of their terms and the full license text that can be included in a file called "LICENSE" in your repo.
MIT License (easy to understand, very permissive, "do whatever you want with my code, I don't care"):
https://tldrlegal.com/license/mit-license
Apache 2.0 (simple, permissive license that is a bit more detailed with a few more obligations for people using the code):
https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)
GNU Lesser General Public License v3 a.k.a. LGPL v3 (copyleft, meaning people will be obligated to open-source changes made to the code but as opposed to the non-lesser version of this license will not force projects using your code as a library to be licensed under the terms of the GPL as well):
https://tldrlegal.com/license/gnu-lesser-general-public-license-v3-(lgpl-3)
Personally, I tend to go with MIT if I just want to put code out there for people to easily use if I don't care who uses the code (or how).
Edit: I'd also suggest the BSD 3-Clause license, as it is very short, concise and easy to understand while being permissive:
https://tldrlegal.com/license/bsd-3-clause-license-(revised)
Full page
I have to write a report, in a printable .pdf with A4 format.
I'd like to use a layout that fill the whole pages. How can I set the height of a <div>
container, to fill the whole page? And, is there a way to insert a page-break
?
Thank you
Remove debug log
There is a log that reads Compiling the template with handlebars
that is coming every time a pdf is created, it's worth removing this to avoid having dirty logs in prod
Can't fix severe vulnerabilities
Fresh install results in 10 high-severity (and unfixable) vulnerabilities, due to dependency on vulnerable version of puppeteer. Would really appreciate if someone could give instructions to update the dependency locally (and hope it still works!) while waiting for an official fix. :)
Navigation timeout on Docker
Printing works perfectly in local development (using a Mac), but as soon as I create the production build and run it under Docker, I get often this error:
(node:1) UnhandledPromiseRejectionWarning: TimeoutError: Navigation timeout of 30000 ms exceeded
at /app/node_modules/puppeteer/lib/cjs/puppeteer/common/LifecycleWatcher.js:106:111
Sometimes it works, most often it doesn't. Here's the Dockerfile:
FROM node:14
# First install dependencies
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
# installs, work.
RUN apt-get update \
&& apt-get install -y wget gnupg \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-freefont-ttf libxss1 \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# Install app dependencies
COPY ./package.json ./package-lock.json /app/
WORKDIR /app
RUN npm install --no-progress --production
# Later, copy the app files. That improves development speed as buiding the Docker image will not have
# to download and install all the NPM dependencies every time there's a change in the source code
COPY ./docker-entrypoint.sh /app/
COPY ./src /app/
ENV NODE_ENV production
EXPOSE 3000
ENTRYPOINT ["bash", "/app/docker-entrypoint.sh"]
CMD ["node", "index.js"]
And the code which is generating the PDF:
const url = "http://127.0.0.1:" + config.www.port + "/blahblahblah";
const file = {url: url};
const options = {
width: "21cm",
height: "2cm",
printBackground: true,
};
html_to_pdf.generatePdf(file, options).then(pdfBuffer => {
console.log("Generated")
...
Any hint?
Thanks a lot
Page boundaries can break lines apart
I'm having a meltdown over this one:
It does not show up on very simple documents. Page breaks work properly most of the time so I was thinking something like using tables as layout could break this but then I remade it into simple divs and the problem is still present.
The text length is entirely user data so I cannot control it.
typescript error
can't use with typescript error import need add @types/html-pdf-node but not found. thanks
npm i --save-dev @types/html-pdf-node
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2fhtml-pdf-node - Not found
npm ERR! 404
npm ERR! 404 '@types/html-pdf-node@*' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
Could not find browser revision 818858. Run "PUPPETEER_PRODUCT=firefox npm install" or "PUPPETEER_PRODUCT=firefox yarn install" to download a supported Firefox browser binary.
2020-12-15T09:43:12.292Z d03d2294-4316-1e4d-5ae2-0e8201298173 ERROR Error: Could not find browser revision 818858. Run "PUPPETEER_PRODUCT=firefox npm install" or "PUPPETEER_PRODUCT=firefox yarn install" to download a supported Firefox browser binary.
at ChromeLauncher.launch (/var/task/node_modules/puppeteer/lib/cjs/puppeteer/node/Launcher.js:79:23)
at async Object.generatePdf (/var/task/node_modules/html-pdf-node/index.js:17:19)
at async create (/var/task/http/controllers/pdf/PdfController.js:92:22)
at async /var/task/routes/index.js:59:3
Got this error when trying to run on AWS EC2. (also tried on aws sam cli)
I tried installing PUPPETEER_PRODUCT=firefox npm install
but still the same
Overlapping content in pdf
Why is file.content is pass twice?
Issue with typrscript
Appreciate your work, can you please confirm
No support for typescript ?
No async/await support ?
More options for inputs
As of now the only options available for input are content
and url
. Inputing a content
causes it to be compiled by handlebars which is an extra step that might not be necessary. I propose adding the following inputs
html
: A raw html (could be a compiled handlebars template or a raw html file content). It would just load it in the browser without further computations, its an optimization on thecontent
as it will avoid recompiling against handlebars something that might not be necessarytemplate
: A handlebars uncompiled html that the library would compile internally it play well withproperties
(see below)path
: A file path the library will load and compile against handlebars. It will also takeproperties
(see below)properties
: An object used to fill the handlebars templates, this abstracts the client from having to use handlebars manually
The only issues I saw is that when using template
and path
the content can't contain custom handlebars helpers, but in that case the consumers would have to use html which is just a replacement of content.
With the above properties it's possible to deprecate content as it can be replaced by any of the above but with the consumers knowledge of whats going on.
I'd be happy to create a PR for this, but I'd like your input @mrafiqk
Puppeteer not clearing temporary files
Hi, when there are lots of HTML files to be converted. Puppeteer is creating files and not clearing them and it's increasing memory utilisation.
Noticing the issue from puppeteer upgrading to 10.0.0.
How to solve this issue?
How to make dynamic page height ?
Is that possible to make the height
to auto / any method to make the page height is dynamic following the content ? I want to make a single page pdf following the content height.
Background colour is not working
I'm using background colour like this
td {
background-color: #000000 !important;
}
But the colour is not visible on any of the td element.
Add debugging possibilities
Hi,
We were building an HTML file with external ressources (asynchronously loaded by JavaScript) that were not displayed at first. With the possiblities given, it was a little bit difficult to point down the problem. So we added the dumpio
argument to puppeteer's launch function to gain some more insights:
const browser = await puppeteer.launch({
dumpio: true,
args: args
});
Would you consider adding a possiblity to enable dumpio? If so, we could also contribute via pull request.
Best regards,
Steven
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.