[英]Merging PDFs with phantomjs
我已經制作了一個API,該API接受輸入並使用html-pdf生成使用pdf傳遞的輸入的服務器端pdf a / c。 然后客戶端將使用它。
現在,需求已發生變化,我希望pdf的前4頁以縱向模式顯示,而其他所有4頁之后的頁面以橫向模式顯示。
但是我們只能定義完整pdf的方向。 這里
所以現在,我嘗試制作兩個單獨的pdf
但是我找不到合並這兩個單獨的pdf(PDF -1 + PDF -2)的解決方案。 有沒有辦法使用phantomjs合並多個pdf。
而且我已經制作了完整的pdf文件,所以我不想更改插件並再次完成完整的工作,但是,如果還有其他一些插件可以解決我的情況,那我也可以用它作為唯一的最后選擇。
謝謝,
要合並多個PDF,請使用pdfkit
和node-pdftk
軟件包:
// dataFiles pass this as an array of string of your s3 object
// or buffer strings or paths & outputPath as a destination
async combinePfds (dataFiles, outputPath){
try {
await pdftk.input(dataFiles).output(outputPath);
} catch (error) {
console.log(error)
}
}
您可以在這里找到代碼: https : //github.com/rauniksingh/async-await-html-pdf---s3
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.