From 2e91e05d7b2dafea943125a9227a46d56b4ff7b5 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 10 Oct 2023 07:14:12 -0400 Subject: [PATCH] Allow "compound" filters that consist of a single named filter (Issue #47) --- CHANGES.md | 4 ++++ pdfio-stream.c | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 5c7039c..144be5d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,10 @@ v1.1.2 (TBD) - Fixed an issue with PDF files produced by Crystal Reports (Issue #45) - Fixed an issue with PDF files produced by Microsoft Reporting Services (Issue #46) +- Fixed support for compound filters where the filter array consists of a + single named filter (Issue #47) +- Fixed builds on Windows - needed windows.h header for temporary files + (Issue #48) v1.1.1 (March 20, 2023) diff --git a/pdfio-stream.c b/pdfio-stream.c index e3e983b..20048c1 100644 --- a/pdfio-stream.c +++ b/pdfio-stream.c @@ -464,11 +464,18 @@ _pdfioStreamOpen(pdfio_obj_t *obj, // I - Object // Try to decode/decompress the contents of this object... const char *filter = pdfioDictGetName(dict, "Filter"); // Filter value + pdfio_array_t *fa; // Filter array + + if (!filter && (fa = pdfioDictGetArray(dict, "Filter")) != NULL && pdfioArrayGetSize(fa) == 1) + { + // Support single-valued arrays... + filter = pdfioArrayGetName(fa, 0); + } if (!filter) { // No single filter name, do we have a compound filter? - if (pdfioDictGetArray(dict, "Filter")) + if (fa) { // TODO: Implement compound filters... _pdfioFileError(st->pdf, "Unsupported compound stream filter.");