Skip to content

Commit 8b9dd2a

Browse files
committed
print a warning if unsupported PDF specials have been ignored
1 parent 26cae42 commit 8b9dd2a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/PdfSpecialHandler.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,16 @@ bool PdfSpecialHandler::process (const string&, istream &is, SpecialActions &act
7373
{"eannot", &PdfSpecialHandler::processEndAnn},
7474
{"endann", &PdfSpecialHandler::processEndAnn},
7575
{"dest", &PdfSpecialHandler::processDest},
76+
// No need to handle the following specials here because they have
77+
// already been completely processed in the preprocessing stage.
78+
{"pagesize", nullptr},
79+
{"mapfile", nullptr},
80+
{"mapline", nullptr}
7681
};
7782
auto it = commands.find(cmdstr);
78-
if (it != commands.end())
83+
if (it == commands.end())
84+
_ignoreCount++;
85+
else if (it->second)
7986
(this->*it->second)(ir, actions);
8087
return true;
8188
}
@@ -280,6 +287,12 @@ void PdfSpecialHandler::dviEndPage (unsigned pageno, SpecialActions &actions) {
280287
HyperlinkManager::instance().createViews(pageno, actions);
281288
_active = false;
282289
}
290+
if (_ignoreCount > 0) {
291+
string suffix = (_ignoreCount > 1 ? "s" : "");
292+
Message::wstream(true) << _ignoreCount << " PDF special" << suffix << " ignored."
293+
<< " The resulting SVG might look wrong.\n";
294+
_ignoreCount = 0;
295+
}
283296
}
284297

285298

src/PdfSpecialHandler.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class PdfSpecialHandler : public SpecialHandler {
5050

5151
private:
5252
bool _active=false;
53+
unsigned _ignoreCount=0; ///< number of ignored PDF specials
5354
};
5455

5556
#endif

0 commit comments

Comments
 (0)