mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-22 22:58:33 +00:00
Update examples to use QPDFObjectHandle iterators
This commit is contained in:
parent
de0b11fc47
commit
ce19ec5c4b
@ -40,25 +40,22 @@ void dumpInfoDict(QPDF& pdf,
|
||||
if (trailer.hasKey("/Info"))
|
||||
{
|
||||
QPDFObjectHandle info = trailer.getKey("/Info");
|
||||
std::set<std::string> keys = info.getKeys();
|
||||
for (std::set<std::string>::const_iterator it = keys.begin();
|
||||
keys.end() != it; ++it)
|
||||
for (auto& it: QPDFDictItems(info))
|
||||
{
|
||||
QPDFObjectHandle elt = info.getKey(*it);
|
||||
std::string val;
|
||||
if (elt.isString())
|
||||
if (it.second.isString())
|
||||
{
|
||||
val = elt.getStringValue();
|
||||
val = it.second.getStringValue();
|
||||
}
|
||||
else if (elt.isName())
|
||||
else if (it.second.isName())
|
||||
{
|
||||
val = elt.getName();
|
||||
val = it.second.getName();
|
||||
}
|
||||
else // according to PDF Spec 1.5, shouldn't happen
|
||||
{
|
||||
val = elt.unparseResolved();
|
||||
val = it.second.unparseResolved();
|
||||
}
|
||||
os << it->substr(1) << sep << val << std::endl; // skip '/'
|
||||
os << it.first.substr(1) << sep << val << std::endl; // skip '/'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user