From b272ac16eec5555b8418f71594fc42a9243975a8 Mon Sep 17 00:00:00 2001 From: dengzhongyuan Date: Wed, 3 Sep 2025 09:29:01 +0800 Subject: [PATCH 1/2] fix: Add dynamic path resolution for htmltopdf Added a new function getHtmlToPdfPath() to dynamically resolve the path for htmltopdf. Updated the htmltopdfCommand in getDocument to use this function instead of a hardcoded path, improving code flexibility and maintainability. bug: https://pms.uniontech.com/bug-view-332133.html --- reader/document/Model.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) 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); From 4d7a5578c47f5b5b8a4a9cf459db195726da812e Mon Sep 17 00:00:00 2001 From: dengzhongyuan Date: Wed, 3 Sep 2025 09:29:12 +0800 Subject: [PATCH 2/2] chore: Update version to 6.5.36 - update version to 6.5.36 log: update version to 6.5.36 --- arm64/linglong.yaml | 2 +- debian/changelog | 6 ++++++ linglong.yaml | 2 +- loong64/linglong.yaml | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) 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.