1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 04:50:09 +00:00

flag to override DRM

This commit is contained in:
John Hewson 2013-01-25 00:56:49 +00:00
parent a225ea3e13
commit 88467667a2
2 changed files with 6 additions and 1 deletions

View File

@ -18,6 +18,7 @@ struct Param
// PDF stuff // PDF stuff
std::string owner_password, user_password; std::string owner_password, user_password;
std::string input_filename, output_filename; std::string input_filename, output_filename;
bool no_drm;
// path // path
std::string dest_dir, tmp_dir, data_dir; std::string dest_dir, tmp_dir, data_dir;

View File

@ -64,6 +64,7 @@ void parse_options (int argc, char **argv)
.add("owner-password,o", &param.owner_password, "", "owner password (for encrypted files)", nullptr, true) .add("owner-password,o", &param.owner_password, "", "owner password (for encrypted files)", nullptr, true)
.add("user-password,u", &param.user_password, "", "user password (for encrypted files)", nullptr, true) .add("user-password,u", &param.user_password, "", "user password (for encrypted files)", nullptr, true)
.add("no-drm", &param.no_drm, false, "override document DRM settings")
.add("dest-dir", &param.dest_dir, ".", "specify destination directory") .add("dest-dir", &param.dest_dir, ".", "specify destination directory")
.add("data-dir", &param.data_dir, PDF2HTMLEX_DATA_PATH, "specify data directory") .add("data-dir", &param.data_dir, PDF2HTMLEX_DATA_PATH, "specify data directory")
@ -192,7 +193,10 @@ int main(int argc, char **argv)
// check for copy permission // check for copy permission
if (!doc->okToCopy()) { 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<int>(max<int>(param.first_page, 1), doc->getNumPages()); param.first_page = min<int>(max<int>(param.first_page, 1), doc->getNumPages());