TCPDF ImageSVG 图片旋转
我想知道这是一个错误,还是我做错了什么。在我向作者报告之前有人可以确认一下吗?
SVG (file.svg):
<svg style="overflow: hidden; position: relative;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1226" version="1.1" height="826"><image transform="matrix(1.0364,-0.3305,0.3305,1.0364,-41.846,108.0143)" preserveAspectRatio="none" x="10" y="10" width="205" height="154" xlink:href="wallpaper.jpg" opacity="1" stroke-width="1"></image><rect transform="matrix(1.0364,-0.3305,0.3305,1.0364,-41.846,108.0143)" x="165" y="114" width="50" height="50" r="0" rx="0" ry="0" fill="#C0C0C0" stroke="#000" opacity="0" stroke-width="1"></rect><image transform="matrix(1.1575,0.2385,-0.2385,1.1575,-442.1395,-145.4163)" preserveAspectRatio="none" x="500" y="10" width="205" height="154" xlink:href="wallpaper.jpg" opacity="1" stroke-width="1"></image><rect transform="matrix(1.1575,0.2385,-0.2385,1.1575,-442.1395,-145.4163)" x="655" y="114" width="50" height="50" r="0" rx="0" ry="0" fill="#C0C0C0" stroke="#000" opacity="0" stroke-width="1"></rect></svg>
PHP 代码:
require_once('../config/lang/eng.php');
require_once('../tcpdf.php');
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->setLanguageArray($l);
$pdf->AddPage();
$pdf->ImageSVG($file='file.svg', $x=15, $y=30, $w='', $h='', $link='', $align='', $palign='', $border=0, $fitonpage=false);
$pdf->Output('sample.pdf', 'F');
svg 文件在浏览器中看起来很好,但在完成的 PDF 中,图像侧面有问题:它们看起来像锯子:
I want to know if its a bug, or im doing something wrong. Can someone confirm it before i report it to the writer?
the SVG (file.svg):
<svg style="overflow: hidden; position: relative;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1226" version="1.1" height="826"><image transform="matrix(1.0364,-0.3305,0.3305,1.0364,-41.846,108.0143)" preserveAspectRatio="none" x="10" y="10" width="205" height="154" xlink:href="wallpaper.jpg" opacity="1" stroke-width="1"></image><rect transform="matrix(1.0364,-0.3305,0.3305,1.0364,-41.846,108.0143)" x="165" y="114" width="50" height="50" r="0" rx="0" ry="0" fill="#C0C0C0" stroke="#000" opacity="0" stroke-width="1"></rect><image transform="matrix(1.1575,0.2385,-0.2385,1.1575,-442.1395,-145.4163)" preserveAspectRatio="none" x="500" y="10" width="205" height="154" xlink:href="wallpaper.jpg" opacity="1" stroke-width="1"></image><rect transform="matrix(1.1575,0.2385,-0.2385,1.1575,-442.1395,-145.4163)" x="655" y="114" width="50" height="50" r="0" rx="0" ry="0" fill="#C0C0C0" stroke="#000" opacity="0" stroke-width="1"></rect></svg>
the PHP code:
require_once('../config/lang/eng.php');
require_once('../tcpdf.php');
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->setLanguageArray($l);
$pdf->AddPage();
$pdf->ImageSVG($file='file.svg', $x=15, $y=30, $w='', $h='', $link='', $align='', $palign='', $border=0, $fitonpage=false);
$pdf->Output('sample.pdf', 'F');
The svg file looks fine in the browser but in thefinished PDF the images sides have problem: they look like a saw:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为在上面的行中您有一个错误
$file='file.svg'
通常需要打开文件并将其存储在变量中并使用以下格式解析变量:其中
$svgString1
是我的 HTML 帖子中的 SVG 图像I think on the above line you has a mistake the
$file='file.svg'
usually needs to open the file and store it in variable and parse the variable with the below format:where
$svgString1
is my SVG image from the post of HTML