wkhtmltopdf
http://wkhtmltopdf.org
downloadsから該当するパッケージをget
http://wkhtmltopdf.org/downloads.html
wget '(URL).rpm'
rpm -iV (ファイル名).rpm
依存性の欠如・・・
依存関係の解消とインストール
wget 'http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-centos6-amd64.rpm'
rpm -i wkhtmltox-0.12.2.1_linux-centos6-amd64.rpm
1 2 3 4 5 |
エラー: 依存性の欠如: libXext は wkhtmltox-1:0.12.2.1-1.x86_64 に必要とされています libXrender は wkhtmltox-1:0.12.2.1-1.x86_64 に必要とされています xorg-x11-fonts-Type1 は wkhtmltox-1:0.12.2.1-1.x86_64 に必要とされています xorg-x11-fonts-75dpi は wkhtmltox-1:0.12.2.1-1.x86_64 に必要とされています |
yum provides libXext
1 2 3 4 5 6 7 8 9 10 11 12 13 |
(省略) libXext-1.3.2-2.1.el6.i686 : X.Org X11 libXext runtime library リポジトリー : base 一致 : libXext-1.3.2-2.1.el6.x86_64 : X.Org X11 libXext runtime library リポジトリー : base 一致 : libXext-1.3.2-2.1.el6.x86_64 : X.Org X11 libXext runtime library リポジトリー : installed 一致 : その他 : Provides-match: libXext |
yum provides libXrender
1 2 3 4 5 6 7 8 9 10 11 12 13 |
(省略) libXrender-0.9.8-2.1.el6.x86_64 : X.Org X11 libXrender runtime library リポジトリー : base 一致 : libXrender-0.9.8-2.1.el6.i686 : X.Org X11 libXrender runtime library リポジトリー : base 一致 : libXrender-0.9.8-2.1.el6.x86_64 : X.Org X11 libXrender runtime library リポジトリー : installed 一致 : その他 : Provides-match: libXrender |
yum provides xorg-x11-fonts-Type1
1 2 3 4 5 6 7 8 9 |
(省略) xorg-x11-fonts-Type1-7.2-11.el6.noarch : Type1 fonts provided by the X Window System リポジトリー : base 一致 : xorg-x11-fonts-Type1-7.2-9.1.el6.noarch : Type1 fonts provided by the X Window System リポジトリー : installed 一致 : その他 : Provides-match: xorg-x11-fonts-Type1 |
yum provides xorg-x11-fonts-75dpi
1 2 3 4 |
(省略) xorg-x11-fonts-75dpi-7.2-11.el6.noarch : A set of 75dpi resolution fonts for the X Window System. リポジトリー : base 一致 : |
依存しているファイルをインストール
yum install libXext-1.3.2-2.1.el6.x86_64
yum install libXrender-0.9.8-2.1.el6.x86_64
yum install xorg-x11-fonts-Type1-7.2-11.el6.noarch
yum install xorg-x11-fonts-75dpi-7.2-11.el6.noarch
再度、目的のファイルをインストール
rpm -iv wkhtmltox-0.12.2.1_linux-centos6-amd64.rpm
(yum install wkhtmltox-0.12.2.1_linux-centos6-amd64.rpm)
ヘルプを表示させてみる
wkhtmltopdf --help
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
Name: wkhtmltopdf 0.12.2.1 (with patched qt) Synopsis: wkhtmltopdf [GLOBAL OPTION]... [OBJECT]... <output file> Document objects: wkhtmltopdf is able to put several objects into the output file, an object is either a single webpage, a cover webpage or a table of content. The objects are put into the output document in the order they are specified on the command line, options can be specified on a per object basis or in the global options area. Options from the Global Options section can only be placed in the global options area A page objects puts the content of a singe webpage into the output document. (page)? <input url/file name> [PAGE OPTION]... Options for the page object can be placed in the global options and the page options areas. The applicable options can be found in the Page Options and Headers And Footer Options sections. A cover objects puts the content of a singe webpage into the output document, the page does not appear in the table of content, and does not have headers and footers. cover <input url/file name> [PAGE OPTION]... All options that can be specified for a page object can also be specified for a cover. A table of content object inserts a table of content into the output document. toc [TOC OPTION]... All options that can be specified for a page object can also be specified for a toc, further more the options from the TOC Options section can also be applied. The table of content is generated via XSLT which means that it can be styled to look however you want it to look. To get an aide of how to do this you can dump the default xslt document by supplying the --dump-default-toc-xsl, and the outline it works on by supplying --dump-outline, see the Outline Options section. Description: Converts one or more HTML pages into a PDF document, using wkhtmltopdf patched qt. Global Options: --collate Collate when printing multiple copies (default) --no-collate Do not collate when printing multiple copies --copies <number> Number of copies to print into the pdf file (default 1) -H, --extended-help Display more extensive help, detailing less common command switches -g, --grayscale PDF will be generated in grayscale -h, --help Display help --license Output license information and exit -l, --lowquality Generates lower quality pdf/ps. Useful to shrink the result document space -O, --orientation <orientation> Set orientation to Landscape or Portrait (default Portrait) -s, --page-size <Size> Set paper size to: A4, Letter, etc. (default A4) -q, --quiet Be less verbose --read-args-from-stdin Read command line arguments from stdin --title <text> The title of the generated pdf file (The title of the first document is used if not specified) -V, --version Output version information and exit Page Options: --print-media-type Use print media-type instead of screen --no-print-media-type Do not use print media-type instead of screen (default) Contact: If you experience bugs or want to request new features please visit <https://github.com/wkhtmltopdf/wkhtmltopdf/issues> |
wkhtmltoimage --help
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
Name: wkhtmltoimage 0.12.2.1 (with patched qt) Synopsis: wkhtmltoimage [OPTIONS]... <input file> <output file> Description: Converts an HTML page into an image, General Options: --crop-h <int> Set height for cropping --crop-w <int> Set width for cropping --crop-x <int> Set x coordinate for cropping --crop-y <int> Set y coordinate for cropping -H, --extended-help Display more extensive help, detailing less common command switches -f, --format <format> Output file format --height <int> Set screen height (default is calculated from page content) (default 0) -h, --help Display help --license Output license information and exit --quality <int> Output image quality (between 0 and 100) (default 94) -q, --quiet Be less verbose -V, --version Output version information and exit --width <int> Set screen width, note that this is used only as a guide line. Use --disable-smart-width to make it strict. (default 1024) Contact: If you experience bugs or want to request new features please visit <https://github.com/wkhtmltopdf/wkhtmltopdf/issues> |
PDF化
wkhtmltopdf http://tech.mg-comp.com test.pdf
pdf用の日本語フォントを用意する
IPAexフォント
http://ipafont.ipa.go.jp/
zipファイルの解答にunzipをインストール
yum install unzip
unzip (ダウンロードファイル名).zip
フォントの登録先を探す
find / -name 'fonts'
cp (解凍フォルダ)/* /usr/share/fonts/
フォントキャッシュのクリア
fc-cache -fv
フォントリストアップ
fc-list
フォントが登録されていたので解凍ディレクトリの削除
rm -rf (解凍フォルダ)
再度PDF化
wkhtmltopdf http://tech.mg-comp.com test2.pdf