New Participant
October 5, 2022
Question
Adobe Acrobat Reader errors on SVGs with stroke-miterlimit
- October 5, 2022
- 1 reply
- 1481 views
Hi Community,
I placed SVGs inside a PDF where some <g> container elements have the attribute `stroke-miterlimit="0"`. It turns out that these attributes are not accepted by Adobe Acrobat Reader and cause not only erronous rendering of the SVG but following elements like tables or other SVGs. I the SVG and produced PDF by using weasyprint (converting example.html to example.pdf).
example.html
<!DOCTYPE html>
<body>
<figure>
<figure>
<!-- b64 encoded example.svg -->
<img
src="data:image/svg+xml;base64,PHN2ZyBiYXNlUHJvZmlsZT0iZnVsbCIgY2xhc3M9Ik1pc3Npb25zQ2FwYWJpbGl0aWVzQmxhbmsiIGhlaWdodD0iMTAwIiB2ZXJzaW9uPSIxLjAiIHZpZXdCb3g9IjAgMCAxMDAgMTAwIiB3aWR0aD0iMTAwIgogICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZyBzdHJva2UtbWl0ZXJsaW1pdD0iMCI+CiAgICAgICAgPHJlY3Qgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9ImFxdWEiIC8+CiAgICA8L2c+Cjwvc3ZnPg=="
/>
<figcaption>This is the SVG caption</figcaption>
</figure>
<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
</table>
</figure>
</body>
The resulting PDF appears to be blank. Nor the SVG, its caption or the table was rendered.
Removing these attributes fixes the problem that only occures with Adobe Acrobat Reader (also online version). Opening the PDF with any other PDF viewer (for e.g. in chrome) displays all expected content.
Cheers
