Commit d1b8bd44af17fa48da6eb309a7e50cd2dbe399d5

Authored by m-holger
Committed by GitHub
2 parents 6aa6c013 fe46d0fb

Merge pull request #1249 from m-holger/example

Tidy qpdfjob-remove-annotations example
examples/qpdfjob-remove-annotations.cc
... ... @@ -15,15 +15,15 @@ static char const* whoami = nullptr;
15 15 static void
16 16 usageExit(std::string const& msg)
17 17 {
18   - std::cerr << std::endl
19   - << whoami << ": " << msg << std::endl
20   - << std::endl
21   - << "For help:" << std::endl
22   - << " " << whoami << " --help=usage usage information" << std::endl
23   - << " " << whoami << " --help=topic help on a topic" << std::endl
24   - << " " << whoami << " --help=--option help on an option" << std::endl
25   - << " " << whoami << " --help general help and a topic list" << std::endl
26   - << std::endl;
  18 + std::cerr << '\n'
  19 + << whoami << ": " << msg << '\n'
  20 + << '\n'
  21 + << "For help:\n"
  22 + << " " << whoami << " --help=usage usage information\n"
  23 + << " " << whoami << " --help=topic help on a topic\n"
  24 + << " " << whoami << " --help=--option help on an option\n"
  25 + << " " << whoami << " --help general help and a topic list\n"
  26 + << '\n';
27 27 exit(QPDFJob::EXIT_ERROR);
28 28 }
29 29  
... ... @@ -40,13 +40,13 @@ realmain(int argc, char* argv[])
40 40 auto qpdf_sp = j.createQPDF();
41 41 auto& pdf = *qpdf_sp;
42 42 for (auto page: pdf.getAllPages()) {
43   - page.replaceKey("/Annots", "null"_qpdf);
  43 + page.removeKey("/Annots");
44 44 }
45 45 j.writeQPDF(pdf);
46 46 } catch (QPDFUsage& e) {
47 47 usageExit(e.what());
48 48 } catch (std::exception& e) {
49   - std::cerr << whoami << ": " << e.what() << std::endl;
  49 + std::cerr << whoami << ": " << e.what() << '\n';
50 50 return QPDFJob::EXIT_ERROR;
51 51 }
52 52 return j.getExitCode();
... ...