I have a little problem here after creating a PDF with TCPDF.
The creation of the PDF file works without any problems. However, when I try to check the PDF in Illustrator, the path name is incorrect.
When I open the SVG directly in Illustrator, the layer is named the way I want it., but when I open the PDF file in Illustrator, this is not the correct path name.. It appears that the attributes id and data-name will be removed from the path after the PDF is created. So, what do I have to do so that the path name is also displayed in the PDF when I open the file with Illustrator?
My SVG string looks like this ...
<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>
... and I put this code in my $svg variable and create the 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, 0, 0, true);
$pdf->SetAutoPageBreak(true);
$pdf->AddPage('L', [600, 100]);
$pdf->ImageSVG('@' . $svg, 0, 0, $pdf->getPageWidth(), $pdf->getPageHeight(), '', 'C', 'C', 0, true);
$pdf->Output('document.pdf');
Everything will work, only I have no way of naming the path in the SVG within the PDF file.
Background: I need this PDF for a printer or laser. These devices can only read PDF files and are complaining that they cannot find the name of the cutting line.