2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-11-09 14:50:58 +00:00

Tidy qpdfjob-remove-annotations example

This commit is contained in:
m-holger 2024-07-21 18:52:25 +01:00
parent b3ab5cd216
commit fe46d0fbb4

View File

@ -15,15 +15,15 @@ static char const* whoami = nullptr;
static void
usageExit(std::string const& msg)
{
std::cerr << std::endl
<< whoami << ": " << msg << std::endl
<< std::endl
<< "For help:" << std::endl
<< " " << whoami << " --help=usage usage information" << std::endl
<< " " << whoami << " --help=topic help on a topic" << std::endl
<< " " << whoami << " --help=--option help on an option" << std::endl
<< " " << whoami << " --help general help and a topic list" << std::endl
<< std::endl;
std::cerr << '\n'
<< whoami << ": " << msg << '\n'
<< '\n'
<< "For help:\n"
<< " " << whoami << " --help=usage usage information\n"
<< " " << whoami << " --help=topic help on a topic\n"
<< " " << whoami << " --help=--option help on an option\n"
<< " " << whoami << " --help general help and a topic list\n"
<< '\n';
exit(QPDFJob::EXIT_ERROR);
}
@ -40,13 +40,13 @@ realmain(int argc, char* argv[])
auto qpdf_sp = j.createQPDF();
auto& pdf = *qpdf_sp;
for (auto page: pdf.getAllPages()) {
page.replaceKey("/Annots", "null"_qpdf);
page.removeKey("/Annots");
}
j.writeQPDF(pdf);
} catch (QPDFUsage& e) {
usageExit(e.what());
} catch (std::exception& e) {
std::cerr << whoami << ": " << e.what() << std::endl;
std::cerr << whoami << ": " << e.what() << '\n';
return QPDFJob::EXIT_ERROR;
}
return j.getExitCode();