如何解决TCPDF - SVG 属性“data-name”将被忽略
在使用 TCPDF 创建 PDF 后,我遇到了一个小问题。
PDF 文件的创建工作没有任何问题。但是,当我尝试在 Illustrator 中检查 PDF 时,路径名不正确。
When I open the SVG directly in Illustrator,the layer is named the way I want it.,但是 when I open the PDF file in Illustrator,this is not the correct path name.。创建 PDF 后,属性 id
和 data-name
似乎将从路径中删除。那么,当我使用 Illustrator 打开文件时,我该怎么做才能让路径名也显示在 PDF 中?
我的 SVG 字符串看起来像这样......
<svg viewBox="0 0 600 100" xmlns="http://www.w3.org/2000/svg">
<path id="my-layer" data-name="my-layer" fill="none" stroke-width="1" stroke="#00f" d="M600 100 60 100 0 50 60 0 600 0 600 100z"/>
</svg>
... 然后我将此代码放入我的 $svg
变量中并创建 PDF ...
$font = TCPDF_FONTS::addTTFfont(__DIR__ . '/assets/fonts/MyCustomFont.ttf','TrueTypeUnicode','',96);
$pdf = new TCPDF('L','mm',[600,100],true,'UTF-8',false);
$pdf->SetFont($font,null,false);
$pdf->SetTitle('Document');
$pdf->SetPrintHeader(false);
$pdf->SetPrintFooter(false);
$pdf->SetMargins(0,true);
$pdf->SetAutoPageBreak(true);
$pdf->AddPage('L',100]);
$pdf->ImageSVG('@' . $svg,$pdf->getPageWidth(),$pdf->getPageHeight(),'C',true);
$pdf->Output('document.pdf');
一切正常,只是我无法在 PDF 文件中命名 SVG 中的路径。
背景:我需要这个用于打印机或激光的 PDF。这些设备只能读取 PDF 文件,并抱怨找不到切割线的名称。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。