coolwanglu / pdf2htmlEX

Convert PDF to HTML without losing text or format.
http://coolwanglu.github.com/pdf2htmlEX/
Other
10.37k stars 1.84k forks source link

poppler 0.59.0 incompatibility #733

Open ilovezfs opened 7 years ago

ilovezfs commented 7 years ago

Tested with pdf2htmlEX 0.14.6 and HEAD @ f12fc155158fd3b217da748f7ed7595fa6f6935c.

[  8%] Building CXX object CMakeFiles/pdf2htmlEX.dir/3rdparty/poppler/git/CairoFontEngine.cc.o
/usr/local/Homebrew/Library/Homebrew/shims/super/clang++   -I/tmp/pdf2htmlex-20170904-32872-1dly7rp/src -I/usr/local/Cellar/poppler/0.59.0/include/poppler -I/usr/local/Cellar/libpng/1.6.32/include/libpng16 -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/fontconfig/2.12.4/include -I/usr/local/Cellar/pixman/0.34.0_1/include/pixman-1 -I/usr/local/Cellar/pcre/8.41/include -I/usr/local/Cellar/glib/2.52.3/include/glib-2.0 -I/usr/local/Cellar/glib/2.52.3/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/cairo/1.14.10/include/cairo -I/tmp/pdf2htmlex-20170904-32872-1dly7rp/3rdparty/poppler/git -I/usr/local/include/freetype2 -I/usr/local/Cellar/pdf2htmlex/HEAD-f12fc15_16/fontforge/include/fontforge -I/usr/local/Cellar/libtiff/4.0.8_3/include -I/usr/include/libxml2  -Wall -stdlib=libc++ -std=c++0x -O2 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.11   -o CMakeFiles/pdf2htmlEX.dir/3rdparty/poppler/git/CairoFontEngine.cc.o -c /tmp/pdf2htmlex-20170904-32872-1dly7rp/3rdparty/poppler/git/CairoFontEngine.cc
/tmp/pdf2htmlex-20170904-32872-1dly7rp/3rdparty/poppler/git/CairoFontEngine.cc:662:41: error: too
      many arguments to function call, expected single argument 'i', have 2 arguments
  gfx->display(charProcs->getVal(glyph, &charProc));
               ~~~~~~~~~~~~~~~~~        ^~~~~~~~~
/usr/local/Cellar/poppler/0.59.0/include/poppler/Dict.h:83:3: note: 'getVal' declared here
  Object getVal(int i);
  ^
/tmp/pdf2htmlex-20170904-32872-1dly7rp/3rdparty/poppler/git/CairoFontEngine.cc:681:12: error: 'free'
      is a private member of 'Object'
  charProc.free();
           ^
/usr/local/Cellar/poppler/0.59.0/include/poppler/Object.h:291:8: note: declared private here
  void free();
       ^
2 errors generated.
make[2]: *** [CMakeFiles/pdf2htmlEX.dir/3rdparty/poppler/git/CairoFontEngine.cc.o] Error 1
make[1]: *** [CMakeFiles/pdf2htmlEX.dir/all] Error 2
make: *** [all] Error 2

Here is the complete log: https://gist.github.com/ilovezfs/28671e8e5b7fae892061585b4d3ee236

HOMEBREW_VERSION: 1.3.2
ORIGIN: https://github.com/Homebrew/brew
HEAD: 751334a257d81851e68da7ab390982d4e9fdf909
Last commit: 51 minutes ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: d1fbe2616bbe8f79345acb1b64a90e07add0fa86
Core tap last commit: 44 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: octa-core 64-bit skylake
Homebrew Ruby: 2.0.0-p648 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.0.0-p648/bin/ruby
Clang: 8.0 build 800
Git: 2.10.1 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Perl: /usr/bin/perl
Python: /usr/local/opt/python/libexec/bin/python => /usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/local/bin/ruby => /usr/local/Cellar/ruby/2.4.1_1/bin/ruby
Java: 1.8.0_121, 1.7.0_154-zulu-7.20.0.3
macOS: 10.11.6-x86_64
Xcode: 8.2.1
CLT: 8.2.0.0.1.1480973914
X11: 2.7.11 => /opt/X11
billeranton commented 7 years ago

Managed to build it with poppler-0.59.0.

The poppler API regarding the class "Object" has changed. The code in font.cc and CairoBackgroundRenderer.cc uses the older API.

I had to remove all calls to free() and change for example following calls: old font.cc line 81:

if(dict->lookup("DescendantFonts", &font_obj2)->isArray())

new font.cc 81:

font_obj2 = dict->lookup("DescendantFonts");
if(font_obj2.isArray())

and so on.

I encountered another problem described in 722 and unfortunately cannot test if the code changes above also ensure correct behavior.

ilovezfs commented 7 years ago

@billeranton maybe open a PR so that the ball moves forward on getting this resolved?

billeranton commented 7 years ago

Added PR #738.