Created attachment 11682 [details] PDF with a pattern fill The attached 250KB PDF is converted to a 45MB SVG because a pattern fill is converted to a large number of separate identical elements instead of using a pattern. Tested with mupdf-tools 1.6.1, Ubuntu 15.04 mudraw -o test.svg Flow-background.pdf
This doesn't look to be a pattern fill to me.
@Robin, it might not be a pattern fill issue but there is an issue here. A 250KB PDF is converted to a 45MB SVG. SVG viewers trying to display it choke.
The original PDF file contains many, many instances of an image (Img4), with a softmask implicit in it. An excerpt from the content stream: q 2.4 0 0 2.4 36.1 592.6 cm /Im4 Do Q repeated many hundred times. Within SVG this converts to: <mask id="ma23"> <g transform="matrix(.48000003,0,0,.48000003,45.8,.000024318695)"> <use xlink:href="#im3" x="0" y="0" width="5" height="5"/> </g> </mask> <g mask="url(#ma23)"> <g transform="matrix(.48000003,0,0,.48000003,45.8,.000024318695)"> <use xlink:href="#im4" x="0" y="0" width="5" height="5"/> </g> </g> i.e. it sets up the mask and then applies it to the image. The textual version in SVG is clearly larger than that in the PDF, and the stream in the PDF gets compressed to save space. That alone explains the differences. It is possible that we could come up with some way to shrink the SVG a bit by spotting that the mask and image are always used together, and to emit a smaller chunk of text (maybe 50% smaller) each time, but a) this isn't easy because of the architecture of MuPDF, and b) this wouldn't make it any easier for SVG renderers to cope with. Fundamentally, the problem is with the way the original file was authored. I don't think there is much we can do here.