aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_Stream.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2010-09-05 17:00:44 +0200
committerJay Berkenbilt <ejb@ql.org>2010-09-05 17:00:44 +0200
commitb1e0dcff16740d5a99e58c298284c5d589b3034f (patch)
tree664300a3128faddb755c375ee90af4e48c4f60b5 /libqpdf/QPDF_Stream.cc
parent0c1dab0cea80e6188d396793b4dc14a11de042f4 (diff)
downloadqpdf-b1e0dcff16740d5a99e58c298284c5d589b3034f.tar.zst
handle stream filter abbreviations from table H.1
git-svn-id: svn+q:///qpdf/trunk@1025 71b93d88-0707-0410-a8cf-f5a4172ac649
Diffstat (limited to 'libqpdf/QPDF_Stream.cc')
-rw-r--r--libqpdf/QPDF_Stream.cc26
1 files changed, 25 insertions, 1 deletions
diff --git a/libqpdf/QPDF_Stream.cc b/libqpdf/QPDF_Stream.cc
index 72be2e32..db6cfb58 100644
--- a/libqpdf/QPDF_Stream.cc
+++ b/libqpdf/QPDF_Stream.cc
@@ -18,6 +18,8 @@
#include <stdexcept>
+std::map<std::string, std::string> QPDF_Stream::filter_abbreviations;
+
QPDF_Stream::QPDF_Stream(QPDF* qpdf, int objid, int generation,
QPDFObjectHandle stream_dict,
off_t offset, int length) :
@@ -93,6 +95,21 @@ QPDF_Stream::filterable(std::vector<std::string>& filters,
int& predictor, int& columns,
bool& early_code_change)
{
+ if (filter_abbreviations.empty())
+ {
+ // The PDF specification provides these filter abbreviations
+ // for use in inline images, but according to table H.1 in the
+ // pre-ISO versions of the PDF specification, Adobe Reader
+ // also accepts them for stream filters.
+ filter_abbreviations["/AHx"] = "/ASCIIHexDecode";
+ filter_abbreviations["/A85"] = "/ASCII85Decode";
+ filter_abbreviations["/LZW"] = "/LZWDecode";
+ filter_abbreviations["/Fl"] = "/FlateDecode";
+ filter_abbreviations["/RL"] = "/RunLengthDecode";
+ filter_abbreviations["/CCF"] = "/CCITTFaxDecode";
+ filter_abbreviations["/DCT"] = "/DCTDecode";
+ }
+
// Initialize values to their defaults as per the PDF spec
predictor = 1;
columns = 0;
@@ -243,7 +260,14 @@ QPDF_Stream::filterable(std::vector<std::string>& filters,
for (std::vector<std::string>::iterator iter = filters.begin();
iter != filters.end(); ++iter)
{
- std::string const& filter = *iter;
+ std::string& filter = *iter;
+
+ if (filter_abbreviations.count(filter))
+ {
+ QTC::TC("qpdf", "QPDF_Stream expand filter abbreviation");
+ filter = filter_abbreviations[filter];
+ }
+
if (! ((filter == "/Crypt") ||
(filter == "/FlateDecode") ||
(filter == "/LZWDecode") ||