marcbachmann / node-html-pdf

This repo isn't maintained anymore as phantomjs got dreprecated a long time ago. Please migrate to headless chrome/puppeteer.
MIT License
3.56k stars 543 forks source link

Is it possible to merge two pdfs? #587

Open kempsteven opened 4 years ago

kempsteven commented 4 years ago

So I have a scenario where I have to get a pdf from a third party API (Xero) and merge it on my own PDF, is that possible? if yes, could you give me an example how? and if no, do you know a package that does that?

Richienb commented 4 years ago

@kempsteven Pass the resulting pdfs to combine-pdfs:

const { promises: fs } = require("fs");
const combinePdfs = require("combine-pdfs");

await fs.writeFile("output.pdf", await combinePdfs([pdf1, pdf2]));
kempsteven commented 4 years ago

so i guess there is no way to merge two pdfs on this package? Thanks for the answer will try that!

Richienb commented 4 years ago

In short, this package converts HTML to PDF. Its purpose is not to merge them.