html2pdf无法缩小图片

时间:2018-08-06 06:59:15

标签: html pdf html2pdf

我正在使用html2pdf从html生成pdf。这是我的代码

require __DIR__.'/vendor/autoload.php';

use Spipu\Html2Pdf\Html2Pdf;

$html2pdf = new Html2Pdf();
$ticketHtml = '<div width="600px"><div class="pageContatiner noSelect ui-droppable" style="width: 760px; height: 500px;" sample="k121"><div onmousedown="objSelection(this)" ontouchstart="objSelection(this)" id="pmObj-2" class="image obj" x="402" y="272" scalex="0.8571428571428571" scaley="0.8571428571428572" style="left: 425px; top: 286px; width: 329px; height: 199px; position: absolute; transform: matrix(0.857143, 0, 0, 0.857143, 0, 0);"><img src="http://html.indusnettechnologies.com/demo/paul-bass/raffle-ticket/images//clip6.png" width="329" height="199"></div><div onmousedown="objSelection(this)" ontouchstart="objSelection(this)" id="pmObj-6" class="text obj" style="left: 499px; top: 122px; width: 233px; position: absolute; transform: matrix(1, 0, 0, 1, 0, 0); height: 69px;" x="499" y="122" scalex="1" scaley="1"><div class="textBox jquery-notebook editor" data-jquery-notebook-id="1" editor-mode="multiline" editor-placeholder="Your text here..." type="text" style="position: relative;" contenteditable="false"><h1>Easter Draw</h1></div></div><div onmousedown="objSelection(this)" ontouchstart="objSelection(this)" id="pmObj-7" class="text obj" style="left: 588px; top: 194px; width: 124px; height: 22px; position: absolute; transform: matrix(1, 0, 0, 1, 0, 0); color: rgb(0, 0, 0); background-color: rgb(252, 179, 67);" x="588" y="194" scalex="1" scaley="1"><div class="textBox" contenteditable="false">Enter Your Text..</div></div><div onmousedown="objSelection(this)" ontouchstart="objSelection(this)" id="pmObj-8" class="text obj" style="left: 235px; top: 230px; width: 488px; position: absolute; transform: matrix(1, 0, 0, 1, 0, 0); height: 23px;" x="235" y="230" scalex="1" scaley="1"><div class="textBox jquery-notebook editor" editor-mode="multiline" editor-placeholder="Your text here..." type="text" style="position: relative;" contenteditable="false"><p>The draw will take place in the school on Sunday, 15th Oct, 2017</p></div></div><div onmousedown="objSelection(this)" ontouchstart="objSelection(this)" id="pmObj-2" class="image obj" x="-252" y="-45" scalex="0.4538310412573674" scaley="0.45383104125736745" style="left: -113px; top: -11px; width: 509px; height: 124px; position: absolute; transform: matrix(0.453831, 0, 0, 0.453831, 0, 0);"><img src="http://html.indusnettechnologies.com/demo/paul-bass/raffle-ticket/images//clip7.png" width="" height=""></div><div onmousedown="objSelection(this)" ontouchstart="objSelection(this)" id="pmObj-2" class="image obj" x="-16" y="-47" scalex="0.44204322200392926" scaley="0.4420432220039293" style="left: 126px; top: -12px; width: 509px; height: 124px; position: absolute; transform: matrix(0.442043, 0, 0, 0.442043, 0, 0);"><img src="http://html.indusnettechnologies.com/demo/paul-bass/raffle-ticket/images//clip7.png" width="" height=""></div><div onmousedown="objSelection(this)" ontouchstart="objSelection(this)" id="pmObj-3" class="image obj" x="218" y="-49" scalex="0.42829076620825146" scaley="0.4282907662082515" style="left: 363px; top: -13px; width: 509px; height: 124px; position: absolute; transform: matrix(0.428291, 0, 0, 0.428291, 0, 0);"><img src="http://html.indusnettechnologies.com/demo/paul-bass/raffle-ticket/images//clip7.png" width="" height=""></div></div></div>';
$html2pdf->writeHTML($ticketHtml);
$html2pdf->output();

但是当我运行它时,图像无法正常显示。它采用整体尺寸而不是缩小尺寸。

寻找任何解决方案。

0 个答案:

没有答案