diff --git a/arm64/linglong.yaml b/arm64/linglong.yaml index 4f687308..43747931 100644 --- a/arm64/linglong.yaml +++ b/arm64/linglong.yaml @@ -7,7 +7,7 @@ version: "1" package: id: org.deepin.reader name: "deepin-reader" - version: 6.5.35.1 + version: 6.5.36.1 kind: app description: | reader for deepin os. diff --git a/debian/changelog b/debian/changelog index 784fa634..c9c24b43 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +deepin-reader (6.5.36) unstable; urgency=medium + + * bug: Add dynamic path resolution for htmltopdf + + -- dengzhongyuan Wed, 03 Sep 2025 09:29:10 +0800 + deepin-reader (6.5.35) unstable; urgency=medium * chore: Update version to 6.5.35 diff --git a/linglong.yaml b/linglong.yaml index 2b24db03..1e3198e8 100644 --- a/linglong.yaml +++ b/linglong.yaml @@ -7,7 +7,7 @@ version: "1" package: id: org.deepin.reader name: "deepin-reader" - version: 6.5.35.1 + version: 6.5.36.1 kind: app description: | reader for deepin os. diff --git a/loong64/linglong.yaml b/loong64/linglong.yaml index bdf76717..83102784 100755 --- a/loong64/linglong.yaml +++ b/loong64/linglong.yaml @@ -7,7 +7,7 @@ version: "1" package: id: org.deepin.reader name: "deepin-reader" - version: 6.5.35.1 + version: 6.5.36.1 kind: app description: | reader for deepin os. diff --git a/reader/document/Model.cpp b/reader/document/Model.cpp index 205c342f..c75463cc 100755 --- a/reader/document/Model.cpp +++ b/reader/document/Model.cpp @@ -17,7 +17,30 @@ #include #include #include +#include + +namespace { + +QString getHtmlToPdfPath() { + + QString path = QString(INSTALL_PREFIX) + "/lib/deepin-reader/htmltopdf"; + if (QFile::exists(path)) { + qDebug() << "Found htmltopdf in INSTALL_PREFIX: " << path; + return path; + } + + path = QLibraryInfo::path(QLibraryInfo::LibrariesPath) + "/deepin-reader/htmltopdf"; + if (QFile::exists(path)) { + qDebug() << "Found htmltopdf in LibrariesPath: " << path; + return path; + } + + qWarning() << "Not found htmltopdf"; + return QString(); +} + +} namespace deepin_reader { deepin_reader::Document *deepin_reader::DocumentFactory::getDocument(const int &fileType, const QString &filePath, @@ -161,7 +184,7 @@ deepin_reader::Document *deepin_reader::DocumentFactory::getDocument(const int & converter2.setWorkingDirectory(convertedFileDir + "/word"); qInfo() << "Converting HTML to PDF:" << realFilePath; - QString htmltopdfCommand = prefix + "/lib/deepin-reader/htmltopdf " + tmpHtmlFilePath + " " + realFilePath; + QString htmltopdfCommand = getHtmlToPdfPath() + " " + tmpHtmlFilePath + " " + realFilePath; qDebug() << "执行命令: " << htmltopdfCommand; #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) converter2.start(htmltopdfCommand);