• wkhtmltopdf 安装过程不包含php扩展部分



    Qt Webkit HTML Converter
    Install wkhtmltopdf
    This page documents installation of wkhtmltopdf on Gentoo Linux using the patched Qt4 libraries from the wkhtmltopdf project.
    Notice that portage provides media-gfx/wkhtmltopdf, but some features will be missing as the binaries are linked against the standard Qt libraries. See the wkhtmltopdf manual for further information.
    Install
    The destination directory will be /usr/local/wkhtmltopd, with the patched Qt 4 installed in the sub directory qt4.
    Prepare source code
    Download the latest source code for wkhtmltopdf:

    bash$> mkdir wkhtmltopdf && cd wkhtmltopdf 
    bash$> wget https://github.com/wkhtmltopdf/wkhtmltopdf/archive/0.11.0_rc2.tar.gz
    bash$> tar zxvf 0.11.0_rc2.tar.gz
    bash$> ln -s wkhtmltopdf-0.11.0_rc2 wkhtmltopdf

    Install patched Qt 4

    Use git to clone the Qt repository.

    bash$>yum install gstreamer-plugins-base-devel
    bash$>wget https://github.com/wkhtmltopdf/qt/archive/v4.8.7.tar.gz
    bash$>tar -zxvf v4.8.7.tar.gz
    bash$>mv qt-4.8.7 wkhtmltopdf-qt
    bash$> cd wkhtmltopdf-qt
    bash$> QTDIR=../bin/syncqt
    bash$> ./configure -nomake tools,examples,demos,docs,translations -opensource -prefix /usr/local/wkhtmltopdf/qt4 
    bash$> make -j6 && make install

    Install wkhtmltopdf 

    With Qt installed, its time to install wkhtmltopdf.

    bash$> cd wkhtmltopdf

    Update QtGui.prl path in common.pri:

    bash$> sed -i s%'QtGui.framework/QtGui.prl'%'libQtGui.prl'%g common.pri

    Generate makefiles, build and install using QMAKE from the patched Qt installation:

    export QMAKESPEC=/usr/local/wkhtmltopdf/qt4/mkspecs/linux-g++

    bash$> /usr/local/wkhtmltopdf/qt4/bin/qmake 
    bash$> make 
    bash$> make install INSTALL_ROOT=/usr/local/wkhtmltopdf

    Setup

    For convenience, create symbolic links in /usr/local/bin and /usr/local/lib:

    bash$> ( cd /usr/local/bin && ln -s ../wkhtmltopdf/bin/* . ) 
    bash$> ( cd /usr/local/lib && ln -s ../wkhtmltopdf/lib/* . )

    Update library resolve cache:

    bash$> ldconfig

    Test 

    Try out the installation with some simple example. If installed correct, there shouldn't be any complains about missing X11. If so, it's an indication that the wrong Qt libraries being used.

    bash$> wkhtmltopdf toc http://www.uu.se uu.pdf
    Loading pages (1/6) 
    Counting pages (2/6) 
    Loading TOC (3/6) 
    Resolving links (4/6) 
    Loading headers and footers (5/6) 
    Printing pages (6/6) 
    Done

    The generated PDF-file should contain the front page and a table of content (TOC).

    bash$> wkhtmltopdf http://www.baidu.com /tmp/baidu.pdf
    Loading pages (1/6) 
    Counting pages (2/6) 
    Loading TOC (3/6) 
    Resolving links (4/6) 
    Loading headers and footers (5/6) 
    Printing pages (6/6) 
    Done

    #遇到的错误及解决方式

    #生成pdf时错误提示
    wkhtmltopdf: cannot connect to X server
    #解决方式
    bash$> yum -y install Xvfb bash$> xvfb-run --server-args="-screen 0, 1024x768x24" wkhtmltopdf http://www.baidu.com /tmp/baidu.pdf

    注:==以上安装不包含安装php的wkhtmltopdf的扩展==。

    如果中文是乱码

    在目录下 /usr/share/fonts/chinese/simsun.ttc 增加该字体
    

      

  • 相关阅读:
    Code Forces 650 C Table Compression(并查集)
    Code Forces 645B Mischievous Mess Makers
    POJ 3735 Training little cats(矩阵快速幂)
    POJ 3233 Matrix Power Series(矩阵快速幂)
    PAT 1026 Table Tennis (30)
    ZOJ 3609 Modular Inverse
    Java实现 LeetCode 746 使用最小花费爬楼梯(递推)
    Java实现 LeetCode 745 前缀和后缀搜索(使用Hash代替字典树)
    Java实现 LeetCode 745 前缀和后缀搜索(使用Hash代替字典树)
    Java实现 LeetCode 745 前缀和后缀搜索(使用Hash代替字典树)
  • 原文地址:https://www.cnblogs.com/xzlive/p/9021013.html
Copyright © 2020-2023  润新知