-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bcb009f56f8f1c9c0d1612a0ec9f581907b51534.patch
46 lines (41 loc) · 1.75 KB
/
bcb009f56f8f1c9c0d1612a0ec9f581907b51534.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From bcb009f56f8f1c9c0d1612a0ec9f581907b51534 Mon Sep 17 00:00:00 2001
From: Volker Krause <vkrause@kde.org>
Date: Sat, 21 Dec 2024 16:44:37 +0100
Subject: [PATCH] Fix compilation against Poppler 25.01
---
src/lib/pdf/pdfdocument.cpp | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/lib/pdf/pdfdocument.cpp b/src/lib/pdf/pdfdocument.cpp
index f829e645..1eb0d61e 100644
--- a/src/lib/pdf/pdfdocument.cpp
+++ b/src/lib/pdf/pdfdocument.cpp
@@ -40,9 +40,14 @@ void PdfPagePrivate::load()
m_doc->m_popplerDoc->processLinks(&device, m_pageNum + 1);
device.finalize();
const auto pageRect = m_doc->m_popplerDoc->getPage(m_pageNum + 1)->getCropBox();
+#if KPOPPLER_VERSION < QT_VERSION_CHECK(25, 1, 0)
std::unique_ptr<GooString> s(device.getText(pageRect->x1, pageRect->y1, pageRect->x2, pageRect->y2));
-
m_text = QString::fromUtf8(s->c_str());
+#else
+ const auto s = device.getText(pageRect->x1, pageRect->y1, pageRect->x2, pageRect->y2);
+ m_text = QString::fromUtf8(s.c_str());
+#endif
+
m_images = std::move(device.m_images);
for (auto it = m_images.begin(); it != m_images.end(); ++it) {
(*it).d->m_page = this;
@@ -107,8 +112,13 @@ QString PdfPage::textInRect(double left, double top, double right, double bottom
TextOutputDev device(nullptr, false, 0, false, false);
d->m_doc->m_popplerDoc->displayPageSlice(&device, d->m_pageNum + 1, 72, 72, 0, false, true, false, -1, -1, -1, -1);
+#if KPOPPLER_VERSION <QT_VERSION_CHECK(25, 1, 0)
std::unique_ptr<GooString> s(device.getText(l, t, r, b));
return QString::fromUtf8(s->c_str());
+#else
+ const auto s = device.getText(l, t, r, b);
+ return QString::fromUtf8(s.c_str());
+#endif
}
int PdfPage::imageCount() const
--
GitLab