diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..04fe0f4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,15 @@ +language: cpp +compiler: gcc +before_install: + - sudo add-apt-repository ppa:coolwanglu/pdf2htmlex --yes + - sudo apt-get update -qq + - sudo apt-get install -qq libpoppler-dev libfontforge-dev libspiro-dev +before_script: + - cmake . +script: + - make + - sudo make install + - /usr/local/bin/pdf2htmlEX -v +branches: + only: + - master diff --git a/CMakeLists.txt b/CMakeLists.txt index 6db0dc5..3fa6c52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ else() include_directories(${FONTFORGE_INCLUDE_DIRS}) # MacOSX gettext is in /opt/local/include - strange if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - find_path(GETTEXT_INCLUDE_PATH libintl.h) + find_path(GETTEXT_INCLUDE_PATH libintl.h HINTS "/usr/local/opt/gettext/include") # homebrew if(GETTEXT_INCLUDE_PATH) include_directories(${GETTEXT_INCLUDE_PATH}) else() diff --git a/README.md b/README.md index 1f7e60d..ce7cbbf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# pdf2htmlEX +# pdf2htmlEX + +[![Build Status](https://secure.travis-ci.org/coolwanglu/pdf2htmlEX.png)](http://travis-ci.org/coolwanglu/pdf2htmlEX) A beautiful demo is worth a thousand words: diff --git a/pdf2htmlEX.1.in b/pdf2htmlEX.1.in index aa9cdbc..3850590 100644 --- a/pdf2htmlEX.1.in +++ b/pdf2htmlEX.1.in @@ -35,6 +35,9 @@ Specify owner password .B -u, --user-password Specify user password .TP +.B --no-drm <0|1> (Default: 0) +Override document DRM settings +.TP .B --dest-dir (Default: .) Specify destination folder .TP diff --git a/src/Param.h b/src/Param.h index 5f9a7d3..2d22396 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; + int no_drm; // path std::string dest_dir, tmp_dir, data_dir; diff --git a/src/pdf2htmlEX.cc b/src/pdf2htmlEX.cc index af1df9a..162ffea 100644 --- a/src/pdf2htmlEX.cc +++ b/src/pdf2htmlEX.cc @@ -53,7 +53,7 @@ void show_version_and_exit(const char * dummy = nullptr) cerr << "Libraries: "; cerr << "poppler " << POPPLER_VERSION << ", "; cerr << "libfontforge " << ffw_get_version() << endl; - exit(EXIT_FAILURE); + exit(EXIT_SUCCESS); } void parse_options (int argc, char **argv) @@ -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, 0, "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 == 0) { + 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());