mgieseki / dvisvgm

A fast DVI, EPS, and PDF to SVG converter
https://dvisvgm.de
GNU General Public License v3.0
312 stars 34 forks source link

Feature Request: option to remove background as Option #217

Closed povpie closed 1 year ago

povpie commented 1 year ago

It would be great if there was also an option to remove the background completely. (pdf to svg with mutools in my case).

(using -Oall) Pdf gets converted with a few boxes inside <defs></defs> and a few boxes inside <page 1> as background. I use my svgs as overlays so I have to manually remove all background before using them, if dvisvgm could do that automatically it would be awesome.

Example: clut

Final result after deleting: image

mgieseki commented 1 year ago

Unfortunately, that's not an easy task. The question is: Which graphics object is considered the background? There is usually no information available to identify background components. The objects are drawn sequentially, one after the other, so that "later" objects may be rendered on top of the ones already drawn (painters model). The first object could be a background rectangle if it encloses all following ones but that's not certain. Instead of removing the background in the SVG, it's probably easier to prevent creating one in the PDF.

povpie commented 1 year ago

I have tried with multiple softwares to delete the background but your comment made me realize that the backgrounds are just other elements. So I was able to delete all of them in acrobat Pro. There's still one box that stays but it's much simpler now. Thanks Martin. Solved.

mgieseki commented 1 year ago

Ok, glad to hear you found a solution that works for you. I'm closing here for now.