LoginSignup
0
0

More than 5 years have passed since last update.

TCPDFのsvgのviewBoxに関するbugfix

Posted at

 TCPDFのsvgの処理の中で、viewBoxの指定に数値以外(=マイナスや小数点)が含まれている場合に正しく処理されていないようだったので、パッチを作りました。
(例によって本家にはpull request送っていないので、気が向いた人がいましたら送ってください)

tcpdf-viewbox.diff
--- tcpdf_min/tcpdf.php Mon Jul 11 01:11:09 2016
+++ tcpdf/tcpdf.php Wed Aug 23 17:31:39 2017
@@ -23815,7 +23815,7 @@
                // parse viewbox, calculate extra transformation matrix
                if (isset($attribs['viewBox'])) {
                    $tmp = array();
-                   preg_match_all("/[0-9]+/", $attribs['viewBox'], $tmp);
+                   preg_match_all("/[0-9.-]+/", $attribs['viewBox'], $tmp);
                    $tmp = $tmp[0];
                    if (sizeof($tmp) == 4) {
                        $vx = $tmp[0];

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0