2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 10:58:58 +00:00

Tweak Handlers::beginUnderOverlay and beginPages

This commit is contained in:
m-holger 2024-01-14 16:53:08 +00:00
parent a41b789995
commit b85a590bc5

View File

@ -232,14 +232,8 @@ void
Handlers::beginUnderOverlay(JSON const& j)
{
// File has to be processed before items, so handle it here.
bool file_seen = false;
std::string file;
j.forEachDictItem([&](std::string const& key, JSON const& value) {
if (key == "file") {
file_seen = value.getString(file);
}
});
if (!file_seen) {
if (!j.getDictItem("file").getString(file)) {
QTC::TC("qpdf", "QPDFJob json over/under no file");
usage("file is required in underlay/overlay specification");
}
@ -488,14 +482,8 @@ Handlers::endPagesArray()
void
Handlers::beginPages(JSON j)
{
bool file_seen = false;
std::string file;
j.forEachDictItem([&](std::string const& key, JSON const& value) {
if (key == "file") {
file_seen = value.getString(file);
}
});
if (!file_seen) {
if (!j.getDictItem("file").getString(file)) {
QTC::TC("qpdf", "QPDFJob json pages no file");
usage("file is required in page specification");
}