I have several SVGs, some of them are quite large (11 MB), and they are created from PDF using pdf2svg .
The problem is that the SVG is too large, it takes a long time to open and is unnecessarily complicated. It mainly contains text and some images (I think a newspaper), and the text is divided into small fragments of characters, even words.
I need to optimize it, first reduce the size, and also reduce the number of elements in order to speed up the download. The only thing I've been thinking so far is to look at the characters that are on the same line and join them in the same <tspan> .
This should significantly reduce the number of text elements, since it looks mainly in groups of 1-5 letters.
But I'm looking for a few more things I can do for SVG to reduce size. There is also the main font, which is used for about 95% of the text, but, as now, all text is defined as glyphs (rendered shapes).
Is it possible to simply insert a font, so the text is displayed as text, and not as shapes?
Also, if you know any better library for converting PDF files to SVG, I would appreciate any input. The only requirement is that it should look the same as in PDF.
I would also like to note that speed is not very important. It doesn't matter how long the conversion takes if it gives the desired result.
svg
Jakub Arnold Jan 25 '12 at 19:52 2012-01-25 19:52
source share