HTMLの「opacity:0.8; 」を削除することで高速化されました。
修正対象のソースは以下のものになります。
:~/rails/app/external/sht_config.php
<div id="ex3" class="jqDnR" style="opacity:0.8; top:{$offsety}px; left:{$offsetx}px; z-index: 3; position: absolute; width: {$width}px; height:{$height}px; font-size: 12px; ">
↓
<div id="ex3" class="jqDnR" style="top:{$offsety}px; left:{$offsetx}px; z-index: 3; position: absolute; width: {$width}px; height:{$height}px; font-size: 12px; ">
以下はベンチマークです。
修正前:
faxocr@ubuntu:~/test$ time wkhtmltopdf --page-size A4 -O Landscape --zoom 2.0 target.html test1.pdf
Loading page (1/2)
Printing pages (2/2)
Done
real 0m37.993s
user 0m17.501s
sys 0m7.740s
修正後:
faxocr@ubuntu:~/test$ time wkhtmltopdf --page-size A4 -O Landscape --zoom 2.0 target.html test1.pdf
Loading page (1/2)
Printing pages (2/2)
Done
real 0m1.290s
user 0m0.648s
sys 0m0.264s
上のコマンドでは使用していないのですが、xvfb-runをかますと少し遅くなりま
す(4秒くらいかかる)。
この修正で、生成されるPDFのサイズも小さくなります。。
修正前:
faxocr@ubuntu:~/test$ ls -al test1.pdf
-rw-r--r-- 1 faxocr faxocr 1884985 2012-08-04 15:13 test1.pdf
修正後:
faxocr@ubuntu:~/test$ ls -al test1.pdf
-rw-r--r-- 1 faxocr faxocr 20433 2012-08-04 15:11 test1.pdf
--
Tsutomu Miyazaki <
tsum...@gmail.com>