Skip to content

Commit

Permalink
Poppler data (texstudio-org#3564)
Browse files Browse the repository at this point in the history
* try relative poppler-data

* fix compile
  • Loading branch information
sunderme authored Mar 12, 2024
1 parent 4bd208a commit 6d1d6be
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ endif()
# poppler

find_package(PkgConfig)
pkg_check_modules(POPPLER QUIET IMPORTED_TARGET poppler-cpp poppler-qt${QT_VERSION_MAJOR})
pkg_check_modules(POPPLER QUIET IMPORTED_TARGET poppler poppler-cpp poppler-qt${QT_VERSION_MAJOR})
if(POPPLER_FOUND)
message(STATUS "Build internal pdf previewer.")
else()
Expand Down
12 changes: 12 additions & 0 deletions src/pdfviewer/pdfrendermanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
#include "configmanagerinterface.h"
#include <QtCore/qmath.h>

#ifdef Q_OS_MAC
// enable setting datadir relative to binary on mac
#include "GlobalParams.h"
#endif

const int kMaxPageZoom = 1000000;

// maximal resolution for rendering
Expand Down Expand Up @@ -150,6 +155,13 @@ QSharedPointer<Poppler::Document> PDFRenderManager::loadDocument(const QString &
return QSharedPointer<Poppler::Document>();
}

#ifdef Q_OS_MAC
QDir dataDir{QCoreApplication::applicationDirPath()};
if (dataDir.cd(QStringLiteral("../share/poppler"))) {
GlobalParamsIniter::setCustomDataDir(qPrintable(dataDir.path()));
}
#endif

std::unique_ptr<Poppler::Document> docPtr;

HiddenByteArray ownerPassword; //for permission settings (not needed?)
Expand Down

0 comments on commit 6d1d6be

Please sign in to comment.