jsreport / jsreport-pdf-utils

jsreport extension providing pdf operations like merge or concatenation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow merging to the existing pdf

pofider opened this issue · comments

Based on this forum thread
https://forum.jsreport.net/topic/441/adding-content-to-existing-pdf

I prepared a demo which would allow to merge existing pdf, but the pdf utils is not able to do the merge
export (23).zip

Stack

(while reading XRef): Error: Invalid XRef stream header
XRefParseException
    at XRefParseExceptionClosure (eval at <anonymous> (E:\temp5\node_modules\pdf2json\lib\pdf.js:64:1), <anonymous>:379:34)
    at eval (eval at <anonymous> (E:\temp5\node_modules\pdf2json\lib\pdf.js:64:1), <anonymous>:384:3)
    at Object.<anonymous> (E:\temp5\node_modules\pdf2json\lib\pdf.js:64:1)
    at Module._compile (module.js:612:30)
    at Object.Module._extensions..js (module.js:623:10)
    at Module.load (module.js:531:32)
    at tryModuleLoad (module.js:494:12)
    at Function.Module._load (module.js:486:3)
    at Module.require (module.js:556:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (E:\temp5\node_modules\pdf2json\pdfparser.js:8:10)

The script loading the pdf from file system in demo could load it using jsreport-proxy from asset instead. That would make it really cool.

Note that fixing this will also make possible to append/prepend existing pdf.

I improved support for merging external static pdfs.
It is now released in the beta if someone wants to try it out.

npm i jsreport-pdf-utils@beta

We will cover this scenario in the docs after we ship it officially.

this feature is published now in 1.2.0, which is part of jsreport 2.3.0, docs are about to be released

Are there any examples where this is being leveraged?