Intercept SVG Generation

Hello,

i would like to intercept the SVG generation process when converting a PDF to SVG to add custom data attributes to the tags as described here : https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*

How can I achieve this?

Theank You!

@cyril.damm

Could you please share complete detail of your use case in which you want to add custom data into SVG? Please also share sample input PDF and expected output SVG here for our reference. We will then provide you more information on it.

Hello!

Actually we are in the evaluation phase to check feasibility of certain approaches. Therefore no samples yet. But it is enough the imagine a One-Page-PDF with just a single TextElement and an image on it, containing … lets say a product name and picture fed from a database table of products. Turning this PDF into a SVG produces something like this:

<svg>
   <image>...</image>
   <text>Foo</text>
</svg>

For beeing able to know to which Product/Image the SVG-Object belongs to when the user clicks it in the SVG, we would like to somehow intercept the SVG-generation process to produce an output similar to this:

<svg data-product-id="xyz">
   <image data-image-id="12345">...</image>
   <text data-table-column="Name">Foo</text>
</svg>

This is what we would like to achieve.
It would also be very helpful to to know what object in the SVG belongs to wich object in the PDF.

Thank You!

@cyril.damm

We have logged a ticket for your requirement as PDFNET-51517 in our issue tracking system. We will check the possibility of implementation of this requirement and update you via this forum thread.

It would be great if you please share the sample input PDF and expected output SVG. We will then update the ticket with your files.