I have multiple SVGs, some of them rather large (11MB) and they're created from a PDF using pdf2svg.
The problem is, that the SVG is too big, takes long time to open, and is unnecessarily complex. It contains mostly text and some images (think newspaper), and the text is split into little chunks of characters, not even words.
I need to optimize it, first to reduce size, and also to reduce the amount of elements to make it load faster. The only thing I thought of so far is looking at characters which are at one line, and join them in a single <tspan>.
This should reduce the amount of text elements by quite a significant margin, because it looks like it's mostly groups of 1-5 letters.
But I am looking for some more things I can do to the SVG to reduce the size. There's also a main font, which is used for about 95% of the text, but as it is right now, all of the text is defined as glyphs (rendered shapes).
Is it possible to just embed the font, so the text is rendered as text, and not as shapes?
Also if you know of any better library for converting PDFs to SVG, I'd appreciate any input. The only requirement is that it the SVG output should look exactly the same as the PDF.
I'd also like to note that speed isn't really important. It doesn't matter how long the conversion takes, as long as it produces the required result.