Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cnstar9988/3571c66b49050d98df92142dc19fbb00 to your computer and use it in GitHub Desktop.
Save cnstar9988/3571c66b49050d98df92142dc19fbb00 to your computer and use it in GitHub Desktop.
````````
========================
1. 安装msys2-i686-20160205.exe,目标目录F:\msys32。
2. 修改F:\msys32\etc\pacman.d,配置msys2和mingw-w64镜像(一般用户请忽略本步骤)。
3. 升级基本环境。
运行msys2_shell.bat
更新本地包数据
pacman -Sy
升级核心包
pacman -S --needed filesystem msys2-runtime bash libreadline libiconv libarchive libgpgme libcurl pacman ncurses libintl
之后需要关闭所有 MSYS2 shell,然后运行 autorebase.bat(这个是必须的,不能省略)
=============确认重新运行msys2_shell.bat=============
升级其他包
pacman -Su
如果后面提示关闭,则重新运行msys2_shell.bat,再次执行一次命令。
4. 安装编译环境。
pacman -S base-devel
pacman -S mingw-w64-i686-toolchain
5. 确认编译环境。
关闭msys2_shell.bat,执行autorebase.bat,然后执行mingw32_shell.bat。
gcc -v确认能看到gcc 5.3.0。
6. 安装相关lib包,这里可以检查pdf2html编译文档,看看需要哪些程序库。
这里可以用pacman -Sl查看软件列表,对比程序库名称。
pacman -S wget mingw-w64-i686-curl mingw-w64-i686-zlib mingw-w64-i686-libffi mingw-w64-i686-pkg-config mingw-w64-i686-gettext
pacman -S mingw-w64-i686-glib2 mingw-w64-i686-libpng mingw-w64-i686-libjpeg-turbo mingw-w64-i686-xz mingw-w64-i686-libtiff mingw-w64-i686-lcms2
pacman -S mingw-w64-i686-libjpeg-turbo mingw-w64-i686-openjpeg mingw-w64-i686-freetype mingw-w64-i686-libxml2 mingw-w64-i686-fontconfig mingw-w64-i686-pixman
pacman -S mingw-w64-i686-cairo mingw-w64-i686-openssl mingw-w64-i686-libssh2 mingw-w64-i686-poppler mingw-w64-i686-poppler-data mingw-w64-i686-pango
pacman -S mingw-w64-i686-libtool mingw-w64-i686-cmake git
pacman -S mingw-w64-i686-nspr mingw-w64-i686-nss
==========正式编译================
1. 将需要编译的软件放在F:\msys32\home\用户名,解压得到fontforge-20160404和pdf2htmlEX-0.14.6。
2. 编译fontforge-20160404.tar.gz。
cd fontforge-20160404
./bootstrap --force(运行成功,建议备份该目录,每次联网下载非常慢)
./configure --prefix=/mingw32 --disable-python-extension --disable-python-scripting && make && make install
3. 编译pdf2htmlEX-0.14.6.tar.gz
先修改一下CMakeLists.txt
先找到代码set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${FONTFORGE_LIBRARIES})
在它之后添加
# Add additional dependencies
set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} intl iconv gettextlib gettextpo gutils png jpeg openjpeg glib-2.0 z xml2 tiff gio-2.0 ltdl)
修改CMakeLists.txt成功之后再执行编译命令。
cd pdf2htmlEX-0.14.6
mkdir build
cd build
cmake .. -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=/mingw32 -DENABLE_SVG=ON
make && make install
==========验证和制作================
mingw下的data目录不一样,编译后无法直接运行,会报“Error: Cannot open the manifest file”。
解决方法:将/mingw32/share/pdf2htmlEX/*.*复制到pdf2htmlEX.exe相同目录的data子目录。pdf2htmlEX代码不用改,里面已经处理过data和tmp目录。
将/mingw32/bin的全部*.dll和pdf2htmlEX.exe,以及data一起组成安装包。
````````
@ColtHands
Copy link

Will there ever be a windows version?

@abdulbadii
Copy link

  1. Install msys2-i686-20160205.exe, the target directory F: \ msys32.
  2. Modify F: \ msys32 \ etc \ pacman.d, configure msys2 and mingw-w64 image (for general users, please ignore this step).
  3. Upgrade the basic environment.

   Run msys2_shell.bat
   
   Update local package data
   pacman -Sy
    
   Upgrade the core package
   pacman -S - filesystem msys2-runtime bash libreadline libiconv libarchive libgpgme libcurl pacman ncurses libintl
   After all the need to close all MSYS2 shell, and then run autorebase.bat (this is a must, can not be omitted)
    
   ============= Confirm re-run msys2_shell.bat =============
   Upgrade other packages
   pacman -Su
   If you are prompted later, run msys2_shell.bat again and execute the command again.
Install the build environment.
   pacman -S base-devel
   pacman -S mingw-w64-i686-toolchain
Confirm the build environment.
   Shut down msys2_shell.bat, execute autorebase.bat, then run mingw32_shell.bat.
   gcc -v Confirm that you can see gcc 5.3.0.

  1. Install the relevant lib package, where you can check the pdf2html compiler documentation to see which libraries are needed.
       Here you can view the software list with pacman -Sl, compare the library name.
       pacman -S wget mingw-w64-i686-curl mingw-w64-i686-zlib mingw-w64-i686-libffi mingw-w64-i686-pkg-config mingw-w64-i686-gettext
       pacman -S mingw-w64-i686-glib2 mingw-w64-i686-libpng mingw-w64-i686-libjpeg-turbo mingw-w64-i686-xz mingw-w64-i686-libtiff mingw-w64-i686-lcms2
       pacman -S mingw-w64-i686-libjpeg-turbo mingw-w64-i686-openjpeg mingw-w64-i686-freetype mingw-w64-i686-libxml2 mingw-w64-i686-fontconfig mingw-w64-i686-pixman
       pacman -S mingw-w64-i686-cairo mingw-w64-i686-openssl mingw-w64-i686-libssh2 mingw-w64-i686-poppler mingw-w64-i686-poppler-data mingw-w64-i686-pango
       pacman -S mingw-w64-i686-libtool mingw-w64-i686-cmake git
       pacman -S mingw-w64-i686-nspr mingw-w64-i686-nss

   
========== Formal Compilation ================

  1. The need to compile the software on the F: \ msys32 \ home \ user name, extracted fontforge-20160404 and pdf2htmlEX-0.14.6.
    Compile fontforge-20160404.tar.gz.
       cd fontforge-20160404
       ./bootstrap --force (run successfully, it is recommended to back up the directory, each network download is very slow)
       ./configure --prefix = / mingw32 --disable-python-extension --disable-python-scripting && make && make install
  2. Compile pdf2htmlEX-0.14.6.tar.gz
       First modify CMakeLists.txt
       Find the code set (PDF2HTMLEX_LIBS $ {PDF2HTMLEX_LIBS} $ {FONTFORGE_LIBRARIES})
       Add after it
       # Add additional dependencies
       set (PDF2HTMLEX_LIBS $ {PDF2HTMLEX_LIBS} intl iconv gettextlib gettextpo gutils png jpeg openjpeg glib-2.0 z xml2 tiff gio-2.0 ltdl)
      
      Modify CMakeLists.txt after successful implementation of the compiler command.
      cd pdf2htmlEX-0.14.6
      mkdir build
      cd build
      cmake .. -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX = / mingw32 -DENABLE_SVG = ON
      make && make install

========== Validation and production ================
  The data directory under mingw is not the same, the compiler can not be run directly, will be reported "Error: Can not open the manifest file."

  Workaround: Copy /mingw32/share/pdf2htmlEX/. to the data subdirectory of the same directory as pdf2htmlEX.exe. pdf2htmlEX code does not change, which has been processed data and tmp directory.
  
  The / mingw32 / bin all * .dll and pdf2htmlEX.exe, and data together to form the installation package

@liuzhifu-chn
Copy link

liuzhifu-chn commented Sep 29, 2018

what happen?
Scanning dependencies of target pdf2htmlEX
[ 2%] Building CXX object CMakeFiles/pdf2htmlEX.dir/3rdparty/poppler/git/CairoFontEngine.c c.obj
F:/msys64/home/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc: In function 'cairo_statu s_t _render_type3_glyph(cairo_scaled_font_t*, long unsigned int, cairo_t*, cairo_text_exten ts_t*)':
F:/msys64/home/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc:662:50: error: no matchin g function for call to 'Dict::getVal(long unsigned int&, Object*)'
gfx->display(charProcs->getVal(glyph, &charProc));
^
In file included from F:/msys64/mingw32/include/poppler/Object.h:351:0,
from F:/msys64/mingw32/include/poppler/GfxFont.h:42,
from F:/msys64/home/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.h:40,
from F:/msys64/home/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc:39:
F:/msys64/mingw32/include/poppler/Dict.h:87:10: note: candidate: Object Dict::getVal(int) c onst
Object getVal(int i) const;
^~~~~~
F:/msys64/mingw32/include/poppler/Dict.h:87:10: note: candidate expects 1 argument, 2 pro vided
F:/msys64/home/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc:681:17: error: 'void Obje ct::free()' is private within this context
charProc.free();
^
In file included from F:/msys64/mingw32/include/poppler/GfxFont.h:42:0,
from F:/msys64/home/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.h:40,
from F:/msys64/home/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc:39:
F:/msys64/mingw32/include/poppler/Object.h:301:8: note: declared private here
void free();
^~~~
make[2]: *** [CMakeFiles/pdf2htmlEX.dir/build.make:63:CMakeFiles/pdf2htmlEX.dir/3rdparty/p oppler/git/CairoFontEngine.cc.obj] 错误 1
make[1]: *** [CMakeFiles/Makefile2:457:CMakeFiles/pdf2htmlEX.dir/all] 错误 2
make: *** [Makefile:141:all] 错误 2

@jverma11
Copy link

jverma11 commented Nov 3, 2018

Hi,

Can someone setup this tool to my xampp server machine that is windows. I also have centOS machine. Whichever suites you.
I need to use this tool to convert microsoft docx into html?
Any freelancer with small budget project like this??
contact me on my email - jv.platform@gmail.com

Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment