diff options
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/QPDFJob_argv.cc | 20 | ||||
-rw-r--r-- | libqpdf/QPDFJob_config.cc | 22 | ||||
-rw-r--r-- | libqpdf/QPDFJob_json.cc | 21 |
3 files changed, 63 insertions, 0 deletions
diff --git a/libqpdf/QPDFJob_argv.cc b/libqpdf/QPDFJob_argv.cc index eadf9a33..737059f0 100644 --- a/libqpdf/QPDFJob_argv.cc +++ b/libqpdf/QPDFJob_argv.cc @@ -409,6 +409,26 @@ ArgParser::argEndCopyAttachment() } void +ArgParser::argSetPageLabels() +{ + this->ap.selectOptionTable(O_SET_PAGE_LABELS); + accumulated_args.clear(); +} + +void +ArgParser::argPageLabelsPositional(std::string const& arg) +{ + accumulated_args.push_back(arg); +} + +void +ArgParser::argEndSetPageLabels() +{ + c_main->setPageLabels(accumulated_args); + accumulated_args.clear(); +} + +void ArgParser::argJobJsonHelp() { *QPDFLogger::defaultLogger()->getInfo() diff --git a/libqpdf/QPDFJob_config.cc b/libqpdf/QPDFJob_config.cc index a0dc10f6..9651c3b9 100644 --- a/libqpdf/QPDFJob_config.cc +++ b/libqpdf/QPDFJob_config.cc @@ -1059,6 +1059,17 @@ QPDFJob::Config::encrypt( return std::shared_ptr<EncConfig>(new EncConfig(this)); } +QPDFJob::Config* +QPDFJob::Config::setPageLabels(const std::vector<std::string>& specs) +{ + // XXX validate + for (auto const& xxx: specs) { + std::cout << "XXX config: spec: " << xxx << std::endl; + } + o.m->page_label_specs = specs; + return this; +} + QPDFJob::EncConfig::EncConfig(Config* c) : config(c) { @@ -1213,3 +1224,14 @@ QPDFJob::EncConfig::forceR5() config->o.m->force_R5 = true; return this; } + +QPDFJob::PageLabelsConfig::PageLabelsConfig(Config* c) : + config(c) +{ +} + +QPDFJob::Config* +QPDFJob::PageLabelsConfig::endSetPageLabels() +{ + return this->config; +} diff --git a/libqpdf/QPDFJob_json.cc b/libqpdf/QPDFJob_json.cc index d44652f4..754cb81b 100644 --- a/libqpdf/QPDFJob_json.cc +++ b/libqpdf/QPDFJob_json.cc @@ -66,6 +66,7 @@ namespace std::shared_ptr<QPDFJob::PagesConfig> c_pages; std::shared_ptr<QPDFJob::UOConfig> c_uo; std::shared_ptr<QPDFJob::EncConfig> c_enc; + std::vector<std::string> accumulated_args; }; } // namespace @@ -565,6 +566,26 @@ Handlers::setupUnderlayPassword() } void +Handlers::setupSetPageLabels() +{ + accumulated_args.clear(); + addParameter([this](char const* p) { accumulated_args.push_back(p); }); +} + +void +Handlers::endSetPageLabelsArray() +{ + c_main->setPageLabels(accumulated_args); + accumulated_args.clear(); +} + +void +Handlers::beginSetPageLabelsArray(JSON) +{ + // nothing needed +} + +void QPDFJob::initializeFromJson(std::string const& json, bool partial) { std::list<std::string> errors; |