Allow building against poppler >= 0.20

This commit is contained in:
Kovid Goyal 2012-05-19 08:14:00 +05:30
parent 8227581a2c
commit e054082d9f
2 changed files with 12 additions and 0 deletions

View File

@ -191,6 +191,9 @@ else:
lh = os.path.join(poppler_inc_dirs[0], 'Link.h')
if 'class AnnotLink' not in open(lh, 'rb').read():
poppler_cflags.append('-DPOPPLER_OLD_LINK_TYPE')
ph = os.path.join(poppler_inc_dirs[0], 'Page.h')
if 'getLinks(Catalog' in open(ph, 'rb').read():
poppler_cflags.append('-DPOPPLER_PRE_20')
magick_error = None
if not magick_inc_dirs or not os.path.exists(os.path.join(magick_inc_dirs[0],

View File

@ -647,7 +647,12 @@ void XMLOutputDev::process_link(AnnotLink* link){
void XMLOutputDev::endPage() {
#ifdef POPPLER_PRE_20
Links *slinks = catalog->getPage(current_page->number())->getLinks(catalog);
#else
Links *slinks = catalog->getPage(current_page->number())->getLinks();
#endif
for (int i = 0; i < slinks->getNumLinks(); i++)
{
this->process_link(slinks->getLink(i));
@ -878,7 +883,11 @@ vector<char>* Reflow::render_first_page(bool use_crop_box, double x_res,
throw ReflowException("Failed to allocate SplashOutputDev");
}
try {
#ifdef POPPLER_PRE_20
out->startDoc(doc->getXRef());
#else
out->startDoc(doc);
#endif
out->startPage(1, NULL);
double pg_w, pg_h;