Skip to content

Commit

Permalink
print a warning if unsupported PDF specials have been ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
mgieseki committed Jan 18, 2025
1 parent 26cae42 commit 8b9dd2a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/PdfSpecialHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,16 @@ bool PdfSpecialHandler::process (const string&, istream &is, SpecialActions &act
{"eannot", &PdfSpecialHandler::processEndAnn},
{"endann", &PdfSpecialHandler::processEndAnn},
{"dest", &PdfSpecialHandler::processDest},
// No need to handle the following specials here because they have
// already been completely processed in the preprocessing stage.
{"pagesize", nullptr},
{"mapfile", nullptr},
{"mapline", nullptr}
};
auto it = commands.find(cmdstr);
if (it != commands.end())
if (it == commands.end())
_ignoreCount++;
else if (it->second)
(this->*it->second)(ir, actions);
return true;
}
Expand Down Expand Up @@ -280,6 +287,12 @@ void PdfSpecialHandler::dviEndPage (unsigned pageno, SpecialActions &actions) {
HyperlinkManager::instance().createViews(pageno, actions);
_active = false;
}
if (_ignoreCount > 0) {
string suffix = (_ignoreCount > 1 ? "s" : "");
Message::wstream(true) << _ignoreCount << " PDF special" << suffix << " ignored."
<< " The resulting SVG might look wrong.\n";
_ignoreCount = 0;
}
}


Expand Down
1 change: 1 addition & 0 deletions src/PdfSpecialHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class PdfSpecialHandler : public SpecialHandler {

private:
bool _active=false;
unsigned _ignoreCount=0; ///< number of ignored PDF specials
};

#endif

0 comments on commit 8b9dd2a

Please sign in to comment.