* BUG: Raise minimal supported poppler version to 0.20

It should be safe because poppler-0.20.0 has been released on May 10, 2012
This commit is contained in:
Laurent Carlier 2020-01-17 09:33:27 +01:00
parent bca4d79191
commit 6440ac1a90
No known key found for this signature in database
GPG key ID: 06096A6AD1CEDDAC
3 changed files with 4 additions and 76 deletions

View file

@ -9,7 +9,7 @@ AC_PROG_LIBTOOL
GB_COMPONENT_SEARCH( GB_COMPONENT_SEARCH(
poppler, POPPLER, gb.pdf, [src], poppler, POPPLER, gb.pdf, [src],
'poppler >= 0.5', 'poppler >= 0.20',
[GB_FIND(PDFDoc.h, `pkg-config --variable=includedir poppler`, poppler)], [GB_FIND(PDFDoc.h, `pkg-config --variable=includedir poppler`, poppler)],
[], [],
[], [],
@ -17,18 +17,6 @@ GB_COMPONENT_SEARCH(
) )
if test "$have_poppler" = "yes"; then if test "$have_poppler" = "yes"; then
pkg-config --atleast-version=0.5 poppler
AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_5, $((1-$?)), Poppler version >= 0.5)
pkg-config --atleast-version=0.5.91 poppler
AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_6, $((1-$?)), Poppler version >= 0.6)
pkg-config --atleast-version=0.8.0 poppler
AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_8, $((1-$?)), Poppler version >= 0.8)
pkg-config --atleast-version=0.11.3 poppler
AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_11_3, $((1-$?)), Poppler version >= 0.11.3)
pkg-config --atleast-version=0.17.0 poppler
AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_17, $((1-$?)), Poppler version >= 0.17)
pkg-config --atleast-version=0.20.0 poppler
AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_20, $((1-$?)), Poppler version >= 0.20)
pkg-config --atleast-version=0.58.0 poppler pkg-config --atleast-version=0.58.0 poppler
AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_58, $((1-$?)), Poppler version >= 0.58) AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_58, $((1-$?)), Poppler version >= 0.58)
pkg-config --atleast-version=0.64.0 poppler pkg-config --atleast-version=0.64.0 poppler

View file

@ -241,11 +241,7 @@ static uint32_t aux_get_page_from_action(void *_object, const_LinkAction *act)
{ {
Ref pref; Ref pref;
const_LinkDest *dest = get_dest(act); const_LinkDest *dest = get_dest(act);
#if POPPLER_VERSION_0_6
const_GooString *name; const_GooString *name;
#else
UGooString *name;
#endif
if (!dest) if (!dest)
{ {
@ -258,10 +254,8 @@ static uint32_t aux_get_page_from_action(void *_object, const_LinkAction *act)
if (name) { if (name) {
#if POPPLER_VERSION_0_64 #if POPPLER_VERSION_0_64
dest = THIS->doc->findDest(name); dest = THIS->doc->findDest(name);
#elif POPPLER_VERSION_0_6
dest = THIS->doc->findDest((GooString *) name);
#else #else
dest = THIS->doc->findDest((UGooString *) name); dest = THIS->doc->findDest((GooString *) name);
#endif #endif
} }
} }
@ -326,11 +320,7 @@ static char* aux_get_target_from_action(const_LinkAction *act)
tmp=((LinkNamed*)act)->getName(); break; tmp=((LinkNamed*)act)->getName(); break;
case actionMovie: case actionMovie:
#if POPPLER_VERSION_0_8
tmp=((LinkMovie*)act)->getAnnotTitle(); break; tmp=((LinkMovie*)act)->getAnnotTitle(); break;
#else
tmp=((LinkMovie*)act)->getTitle(); break;
#endif
default: default:
break; break;
@ -486,13 +476,7 @@ int32_t open_document (void *_object, char *sfile, int32_t lfile)
white[0] = 0xFF; white[1] = 0xFF; white[2] = 0xFF; white[0] = 0xFF; white[1] = 0xFF; white[2] = 0xFF;
THIS->dev=new SplashOutputDev(splashModeRGB8, 3, false, white); THIS->dev=new SplashOutputDev(splashModeRGB8, 3, false, white);
#if POPPLER_VERSION_0_20
THIS->dev->startDoc(THIS->doc); THIS->dev->startDoc(THIS->doc);
#else
THIS->dev->startDoc(THIS->doc->getXRef ());
#endif
outline=THIS->doc->getOutline(); outline=THIS->doc->getOutline();
if (outline) THIS->index=outline->getItems(); if (outline) THIS->index=outline->getItems();
@ -605,11 +589,7 @@ END_PROPERTY
BEGIN_PROPERTY(PDFINFO_format) BEGIN_PROPERTY(PDFINFO_format)
char ctx[16]; char ctx[16];
#if POPPLER_VERSION_0_11_3 snprintf(ctx, sizeof(ctx), "%.2g", THIS->doc->getPDFMajorVersion () + THIS->doc->getPDFMinorVersion() / 10.0);
snprintf(ctx, sizeof(ctx), "%.2g", THIS->doc->getPDFMajorVersion () + THIS->doc->getPDFMinorVersion() / 10.0);
#else
snprintf(ctx, sizeof(ctx), "%.2g", THIS->doc->getPDFVersion());
#endif
GB.ReturnNewZeroString(ctx); GB.ReturnNewZeroString(ctx);
END_PROPERTY END_PROPERTY
@ -927,22 +907,12 @@ static uint32_t *get_page_data(CPDFDOCUMENT *_object, int32_t x, int32_t y, int3
if ( (w<0) || (h<0) ) return NULL; if ( (w<0) || (h<0) ) return NULL;
#if POPPLER_VERSION_0_20
THIS->page->displaySlice(THIS->dev,72.0*scale,72.0*scale, THIS->page->displaySlice(THIS->dev,72.0*scale,72.0*scale,
rotation, rotation,
false, false,
true, true,
x,y,w,h, x,y,w,h,
false); false);
#else
THIS->page->displaySlice(THIS->dev,72.0*scale,72.0*scale,
rotation,
false,
true,
x,y,w,h,
false,
THIS->doc->getCatalog ());
#endif
map=THIS->dev->getBitmap(); map=THIS->dev->getBitmap();
@ -1001,13 +971,8 @@ BEGIN_METHOD(PDFPAGE_select, GB_INTEGER X; GB_INTEGER Y; GB_INTEGER W; GB_INTEGE
w = VARGOPT(W, (int32_t)THIS->page->getMediaWidth()); w = VARGOPT(W, (int32_t)THIS->page->getMediaWidth());
h = VARGOPT(H, (int32_t)THIS->page->getMediaHeight()); h = VARGOPT(H, (int32_t)THIS->page->getMediaHeight());
#if POPPLER_VERSION_0_20
dev = new TextOutputDev (NULL, true, 0, false, false); dev = new TextOutputDev (NULL, true, 0, false, false);
gfx = THIS->page->createGfx(dev,72.0,72.0,0,false,true,-1, -1, -1, -1, false, NULL, NULL); gfx = THIS->page->createGfx(dev,72.0,72.0,0,false,true,-1, -1, -1, -1, false, NULL, NULL);
#else
dev = new TextOutputDev (NULL, true, false, false);
gfx = THIS->page->createGfx(dev,72.0,72.0,0,false,true,-1, -1, -1, -1, false,THIS->doc->getCatalog (),NULL, NULL, NULL, NULL);
#endif
THIS->page->display(gfx); THIS->page->display(gfx);
dev->endPage(); dev->endPage();
@ -1036,16 +1001,7 @@ END_METHOD
void aux_fill_links(void *_object) void aux_fill_links(void *_object)
{ {
#if POPPLER_VERSION_0_20
THIS->links = new Links (THIS->page->getAnnots ()); THIS->links = new Links (THIS->page->getAnnots ());
#elif POPPLER_VERSION_0_17
THIS->links = new Links (THIS->page->getAnnots (THIS->doc->getCatalog()));
#else
Object obj;
THIS->links = new Links (THIS->page->getAnnots (&obj),THIS->doc->getCatalog()->getBaseURI ());
obj.free();
#endif
} }
BEGIN_PROPERTY (PDFPAGELINKS_count) BEGIN_PROPERTY (PDFPAGELINKS_count)
@ -1222,22 +1178,13 @@ BEGIN_METHOD (PDFPAGE_find,GB_STRING Text; GB_BOOLEAN Sensitive;)
if (!MISSING(Sensitive)) sensitive=VARG(Sensitive); if (!MISSING(Sensitive)) sensitive=VARG(Sensitive);
#if POPPLER_VERSION_0_20
textdev = new TextOutputDev (NULL, true, 0, false, false); textdev = new TextOutputDev (NULL, true, 0, false, false);
THIS->page->display (textdev, 72, 72, 0, false, false, false); THIS->page->display (textdev, 72, 72, 0, false, false, false);
#else
textdev = new TextOutputDev (NULL, true, false, false);
THIS->page->display (textdev, 72, 72, 0, false, false, false, THIS->doc->getCatalog());
#endif
if (THIS->Found) { GB.FreeArray(POINTER(&THIS->Found)); THIS->Found=NULL; } if (THIS->Found) { GB.FreeArray(POINTER(&THIS->Found)); THIS->Found=NULL; }
count = 0; count = 0;
#if POPPLER_VERSION_0_20
while (textdev->findText (block,nlen,false,true,true,false,sensitive,false,false,&x0,&y0,&x1,&y1)) while (textdev->findText (block,nlen,false,true,true,false,sensitive,false,false,&x0,&y0,&x1,&y1))
#else
while (textdev->findText (block,nlen,false,true,true,false,sensitive,false,&x0,&y0,&x1,&y1))
#endif
{ {
if (!THIS->Found) if (!THIS->Found)
GB.NewArray(POINTER(&THIS->Found),sizeof(CPDFFIND),1); GB.NewArray(POINTER(&THIS->Found),sizeof(CPDFFIND),1);

View file

@ -57,15 +57,8 @@ int EXPORT GB_INIT(void)
{ {
#if POPPLER_VERSION_0_83 #if POPPLER_VERSION_0_83
globalParams = std::unique_ptr<GlobalParams>(); globalParams = std::unique_ptr<GlobalParams>();
#elif POPPLER_VERSION_0_6 #else
globalParams = new GlobalParams(); globalParams = new GlobalParams();
#else
globalParams = new GlobalParams("/etc/xpdfrc");
#endif
#if POPPLER_VERSION_0_5
#else
globalParams->setupBaseFontsFc(NULL);
#endif #endif
} }