summaryrefslogtreecommitdiff
path: root/sdext/source/pdfimport/xpdfwrapper
diff options
context:
space:
mode:
authorMichael Warner <michael.warner.ut+libreoffice@gmail.com>2021-05-11 09:22:27 -0400
committerMichael Stahl <michael.stahl@allotropia.de>2021-06-23 11:21:00 +0200
commit648e4106cc002ff5b8184a8c104f93cb06e4b540 (patch)
tree9b0052d02699d483437301a5a743dcdf54d6b5c7 /sdext/source/pdfimport/xpdfwrapper
parent388d52a9193d89058f27b3efd48ab3cd5dedf0a7 (diff)
tdf#141709: Use poppler_data
Bundle the files from poppler_data and provide the path to them to poppler when the bundled poppler library is used. Change-Id: I13a2ef861303a0be17aa0a861ef8ac96ed8a93be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117523 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sdext/source/pdfimport/xpdfwrapper')
-rw-r--r--sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx23
1 files changed, 21 insertions, 2 deletions
diff --git a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
index b1a54bd09c5f..ad6320139473 100644
--- a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
@@ -22,6 +22,11 @@
# include <io.h>
# include <fcntl.h> /*_O_BINARY*/
#endif
+#ifndef SYSTEM_POPPLER
+#include <string> // std::string
+#include <cstddef> // std::size_t
+#include <config_folders.h> //LIBO_SHARE_FOLDER
+#endif
FILE* g_binary_out=stderr;
@@ -67,11 +72,25 @@ int main(int argc, char **argv)
++k;
}
+ /* Get data directory location */
+#ifdef SYSTEM_POPPLER
+ const char* datadir = nullptr;
+#else
+ /* Creates an absolute path to the poppler_data directory, by taking the path
+ * to the xpdfimport executable (provided in argv[0], and concatenating a
+ * relative path to the poppler_data directory from the program directory. */
+ const std::string execPath = argv[0];
+ const std::size_t filenameStartPos = execPath.find_last_of("/\\")+1;
+ const std::string programPath = execPath.substr(0,filenameStartPos);
+ const std::string popplerDataPath = programPath + "../" LIBO_SHARE_FOLDER "/xpdfimport/poppler_data";
+ const char* datadir = popplerDataPath.c_str();
+#endif
+
// read config file
#if POPPLER_CHECK_VERSION(0, 83, 0)
- globalParams = std::make_unique<GlobalParams>();
+ globalParams = std::make_unique<GlobalParams>(datadir);
#else
- globalParams = new GlobalParams();
+ globalParams = new GlobalParams(datadir);
#endif
globalParams->setErrQuiet(true);
#if defined(_MSC_VER)