From 88467667a224fc03713cb8be794695179bd81501 Mon Sep 17 00:00:00 2001 From: John Hewson Date: Fri, 25 Jan 2013 00:56:49 +0000 Subject: [PATCH] flag to override DRM --- src/Param.h | 1 + src/pdf2htmlEX.cc | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Param.h b/src/Param.h index 5f9a7d3..ae80ba7 100644 --- a/src/Param.h +++ b/src/Param.h @@ -18,6 +18,7 @@ struct Param // PDF stuff std::string owner_password, user_password; std::string input_filename, output_filename; + bool no_drm; // path std::string dest_dir, tmp_dir, data_dir; diff --git a/src/pdf2htmlEX.cc b/src/pdf2htmlEX.cc index af1df9a..8d60016 100644 --- a/src/pdf2htmlEX.cc +++ b/src/pdf2htmlEX.cc @@ -64,6 +64,7 @@ void parse_options (int argc, char **argv) .add("owner-password,o", ¶m.owner_password, "", "owner password (for encrypted files)", nullptr, true) .add("user-password,u", ¶m.user_password, "", "user password (for encrypted files)", nullptr, true) + .add("no-drm", ¶m.no_drm, false, "override document DRM settings") .add("dest-dir", ¶m.dest_dir, ".", "specify destination directory") .add("data-dir", ¶m.data_dir, PDF2HTMLEX_DATA_PATH, "specify data directory") @@ -192,7 +193,10 @@ int main(int argc, char **argv) // check for copy permission if (!doc->okToCopy()) { - throw "Copying of text from this document is not allowed."; + if (!param.no_drm) { + throw "Copying of text from this document is not allowed."; + } + cerr << "Document has copy-protection bit set." << endl; } param.first_page = min(max(param.first_page, 1), doc->getNumPages());