Source: pdf2djvu
Version: 0.9.18.2-2.2
Severity: normal
Tags: ftbfs patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Dear Maintainer,

pdf2djvu fails to build against poppler 26.07 (currently in
experimental, unstable is still on 26.01). Several poppler API
changes across the 26.02-26.07 releases break the build:

- - 26.02: SplashOutputDev dropped the reverseVideo ctor parameter;
  GfxState::getCTM() now returns const std::array<double,6>&;
  SplashFont::getGlyph() takes the clip by const SplashClip&.
- - 26.04: Object::getString() now returns const std::string&.
- - 26.05: the SplashCoord alias to double was removed.
- - 26.06: GfxColorSpace::getRGB() takes a const GfxColor&;
  Annot::getColor() returns const AnnotColor*.
- - 26.07: Catalog::indexToLabel() takes a std::string*.

The attached patch guards each change with the existing integer
POPPLER_VERSION check, so older poppler still builds. Feel free to
apply it whenever poppler 26.07 reaches unstable

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEuVOE/FJ0HcdfWSw//lAdKwFeZPsFAmpjSxsACgkQ/lAdKwFe
ZPvbUQ/9E9N3iVRSL/sJdQgTVdWVbl0V7FVxbKir9gdv0ehtup0PL2YXdqe3ZGI9
889Ues9fxzko+FVjPYbljMHEmDYutp7q2/4dx2HzwEh7oiVjLg0UrCHl9A5yAfWK
1ZYJtFwgjaz0grLRNE+Mvy5CeO0rPwXmZvulFjhRVLCkmrmnwhuFLEPbYN/gLkvo
B/WKjPuy2Nk9gG3yUznxISN2mG+fW95sVLeJH2gP23NBugIgXC+PwrF4TTIrYahj
LPzWqPcptzmLq9Lwy23NIglvKpeXOjJB84Mq4WIVrHwM0+K02A8Jf0E+Q1FzP34y
daswSMZQmw/7LII0JWkFmoDAU8asIuk92OzMaNXjKEEez/ZiNGGyHvxLelImpQ2g
D4LWdeDOu1YIW9Ymcfj7xhLxO/td/0n0qIbtAryJ/6ddEyIfUOXXzwgL4smT8mvm
etbsFjMJmW/q1HmCf7qb+/6ctoHk6ZhyjmzqW7yk9IrC4CvtV0AHW7XPn6ar6OwH
TFQeW3TKDRsSUS5hW1UaIr5oHT1JDiWhTKCPCUtjfVUchFv/nsVWnPVzuouUrodz
JaagN60PWOwfl4UhmS52rfol8mkf6GKMhXvUg7lOLonvRu0U4JTmCNQfCiE1IAo1
7KKtnVwfiIoHstOaEEtvP5S78b0zMfx6wXeARlTWzvT+fVXZgOk=
=m6m6
-----END PGP SIGNATURE-----
Description: Fix FTBFS with poppler >= 26.02
 Several poppler API changes across the 26.02-26.07 releases break the
 build:
 - 26.02 dropped the SplashOutputDev reverseVideo parameter, made
   GfxState::getCTM() return a const std::array<double, 6>& and made
   SplashFont::getGlyph() take the clip by const SplashClip&
 - 26.04 made Object::getString() return a const std::string&
 - 26.05 removed the SplashCoord alias to double
 - 26.06 made GfxColorSpace::getRGB() take a const GfxColor& and
   Annot::getColor() return a const AnnotColor*
 - 26.07 made Catalog::indexToLabel() take a std::string*
 Each change is guarded by the existing integer POPPLER_VERSION check,
 so older poppler still builds
Author: Nadzeya Hutsko <[email protected]>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2161719
Forwarded: no
Last-Update: 2026-07-24
--- a/pdf-backend.cc
+++ b/pdf-backend.cc
@@ -164,7 +164,12 @@
   pdf::gfx::RgbColor rgb_cc;
   for (int i = 0; i < 4; i++)
     cmyk_cc.c[i] = pdf::gfx::double_as_color_component(cmyk[i]);
+#if POPPLER_VERSION >= 260600
+  // poppler 26.06 changed getRGB() to take a const GfxColor &
+  cmyk_space.getRGB(cmyk_cc, &rgb_cc);
+#else
   cmyk_space.getRGB(&cmyk_cc, &rgb_cc);
+#endif
   rgb[0] = pdf::gfx::color_component_as_double(rgb_cc.r);
   rgb[1] = pdf::gfx::color_component_as_double(rgb_cc.g);
   rgb[2] = pdf::gfx::color_component_as_double(rgb_cc.b);
@@ -176,7 +181,12 @@
   std::string border_color;
   if (annotation->getType() != pdf::ant::Annotation::typeLink)
     return true;
+#if POPPLER_VERSION >= 260600
+  // poppler 26.06 made Annot::getColor() return a const AnnotColor *
+  const pdf::ant::Color *color = annotation->getColor();
+#else
   pdf::ant::Color *color = annotation->getColor();
+#endif
   if (color == nullptr)
   {
     border_colors.push_back("");
@@ -411,7 +421,12 @@
     char tzs = 0; int tzh = 0, tzm = 0;
     if (!pdf::dict_lookup(info_dict, field.first, &object)->isString())
       continue;
+#if POPPLER_VERSION >= 260400
+    // poppler 26.04 made Object::getString() return a const std::string &
+    const char *input = object.getString().c_str();
+#else
     const char *input = pdf::get_c_string(object.getString());
+#endif
     if (input[0] == 'D' && input[1] == ':')
       input += 2;
     int year = scan_date_digits(input, 4);
@@ -474,7 +489,12 @@
 bool pdf::Environment::antialias = false;
 
 pdf::Renderer::Renderer(pdf::splash::Color &paper_color, bool monochrome)
+#if POPPLER_VERSION >= 260200
+// poppler 26.02 dropped the reverseVideo parameter
+: pdf::splash::OutputDevice(monochrome ? splashModeMono1 : splashModeRGB8, 4, 
paper_color)
+#else
 : pdf::splash::OutputDevice(monochrome ? splashModeMono1 : splashModeRGB8, 4, 
false, paper_color)
+#endif
 {
   this->setFontAntialias(pdf::Environment::antialias);
   this->setVectorAntialias(pdf::Environment::antialias);
@@ -503,7 +523,10 @@
     return false;
   splash::ClipResult clip_result;
   if (!font->getGlyph(code, 0, 0, bitmap, static_cast<int>(x), 
static_cast<int>(y),
-#if POPPLER_VERSION >= 260100
+#if POPPLER_VERSION >= 260200
+      // poppler 26.02 made getGlyph() take the clip by const SplashClip &
+      splash->getClip(),
+#elif POPPLER_VERSION >= 260100
       const_cast<SplashClip*>(&splash->getClip()),
 #else
       splash->getClip(),
--- a/pdf-backend.hh
+++ b/pdf-backend.hh
@@ -63,7 +63,12 @@
     typedef ::Splash Splash;
     typedef ::SplashColor Color;
     typedef ::SplashFont Font;
+#if POPPLER_VERSION >= 260500
+    // poppler 26.05 removed the SplashCoord alias to double
+    typedef double Coord;
+#else
     typedef ::SplashCoord Coord;
+#endif
     typedef ::SplashPath Path;
     typedef ::SplashGlyphBitmap GlyphBitmap;
     typedef ::SplashBitmap Bitmap;
--- a/pdf-document-map.cc
+++ b/pdf-document-map.cc
@@ -41,11 +41,21 @@
             std::unique_ptr<pdf::Document> doc(new pdf::Document(path));
             pdf::Catalog *catalog = doc->getCatalog();
             for (int i = 0; i < doc->getNumPages(); i++) {
+#if POPPLER_VERSION >= 260700
+                // poppler 26.07 made Catalog::indexToLabel take a std::string 
*
+                std::string s;
+                if (catalog->indexToLabel(i, &s)) {
+                    pdf::String gs(s);
+                    std::string str = pdf::string_as_utf8(&gs);
+                    this->labels.push_back(str);
+                }
+#else
                 pdf::String s;
                 if (catalog->indexToLabel(i, &s)) {
                     std::string str = pdf::string_as_utf8(&s);
                     this->labels.push_back(str);
                 }
+#endif
                 else
                     this->labels.push_back("");
                 global_index++;
--- a/pdf-dpi.cc
+++ b/pdf-dpi.cc
@@ -91,7 +91,12 @@
 
 void DpiGuessDevice::process_image(pdf::gfx::State *state, int width, int 
height)
 {
+#if POPPLER_VERSION >= 260200
+  // poppler 26.02 made getCTM() return a const std::array<double, 6> &
+  const double *ctm = state->getCTM().data();
+#else
   const double *ctm = state->getCTM();
+#endif
   double h_dpi = 72.0 * width / hypot(ctm[0], ctm[1]);
   double v_dpi = 72.0 * height / hypot(ctm[2], ctm[3]);
   this->min_ = std::min(this->min_, std::min(h_dpi, v_dpi));
--- a/pdf-unicode.cc
+++ b/pdf-unicode.cc
@@ -117,7 +117,13 @@
 
 std::string pdf::string_as_utf8(pdf::Object &object)
 {
+#if POPPLER_VERSION >= 260400
+    // poppler 26.04 made Object::getString() return a const std::string &
+    pdf::String s(object.getString());
+    return pdf::string_as_utf8(&s);
+#else
     return pdf::string_as_utf8(object.getString());
+#endif
 }
 
 /* class pdf::FullNFKC

Reply via email to