gofpdi
gofpdi copied to clipboard
zlib.NewReader(bytes.NewBuffer(stream)) can return an error and a nil value
I have a pdf where the encoding does not seem to be supported, but I think you should check the error here, otherwise I get a runtime error.
runtime error: invalid memory address or nil pointer dereference
https://github.com/phpdave11/gofpdi/blob/cf771f66a372da8380cb6c9fe5d9d40133dcc563/reader.go#L509
I'm running into the same issue, it's assuming zlib can de-compress it and is returning
// ErrHeader is returned when reading ZLIB data that has an invalid header.
ErrHeader = errors.New("zlib: invalid header")
I fixed it in my fork https://github.com/chaintraced/gofpdi/pull/1, but haven't opened a PR here yet since my previous one is still dangling. https://github.com/phpdave11/gofpdi/pull/60