rkusa / pdfjs

A Portable Document Format (PDF) generation library targeting both the server- and client-side.
MIT License
786 stars 142 forks source link

Error: Unsupported PNG filter 3 #295

Open chrismorison-wt opened 1 year ago

chrismorison-wt commented 1 year ago

While adding an external pdf with new pdfjs.ExternalDocument(buffer); I am getting the error:

Error: Unsupported PNG filter 3
    at pngFilter (util.js:102:13)
    at exports.inflate (util.js:77:11)
    at PDFXref.parseXrefObject (xref.js:126:25)
    at PDFXref.parse (xref.js:74:19)
    at Parser.parse (parser.js:47:29)
    at new ExternalDocument (external.js:25:12)
    at generatePDF (generatePDF.ts:165:17)

Looking at util.js I see it only supports filter type 2. According to the PNG specification there are 4 filter types.

Is there any chance of getting filter type 3 supported - or all of them?

I'm sorry I cannot provide the pdf source file which is causing this issue due to confidentiality.

rkusa commented 1 year ago

I am open to accept contributions adding them, but I am afraid that I am most probably not going to add them myself, as I haven't encountered any other PNGs than type 2 in my use-case of pdfjs. No need for the PDF source file in this case.