Fix build with poppler-26.04.0.

From upstream commit 4c6443c7b9795d43b15fdf9c47347edae1068dd3.

Index: frmts/pdf/pdfobject.cpp
--- frmts/pdf/pdfobject.cpp.orig
+++ frmts/pdf/pdfobject.cpp
@@ -20,6 +20,7 @@
 #include "gdal_pdf.h"
 
 #include <limits>
+#include <type_traits>
 #include <vector>
 #include "pdfobject.h"
 
@@ -1122,8 +1123,24 @@ const std::string &GDALPDFObjectPoppler::GetString()
 {
     if (GetType() == PDFObjectType_String)
     {
-        const GooString *gooString = m_poConst->getString();
-        const std::string &osStdStr = gooString->toStr();
+        const std::string &osStdStr = *(
+            [](auto &&obj) -> const std::string *
+            {
+                if constexpr (std::is_same_v<decltype(obj),
+                                             const std::string &>)
+                {
+                    // Since Poppler 26.04
+                    return &obj;
+                }
+                else
+                {
+                    static_assert(
+                        std::is_same_v<decltype(obj), const GooString *&&>);
+                    static_assert(std::is_same_v<decltype(obj->toStr()),
+                                                 const std::string &>);
+                    return &(obj->toStr());
+                }
+            }(m_poConst->getString()));
         const bool bLEUnicodeMarker =
             osStdStr.size() >= 2 && static_cast<uint8_t>(osStdStr[0]) == 0xFE &&
             static_cast<uint8_t>(osStdStr[1]) == 0xFF;
