You can clone with
Actually I've attempted to do this for a while, but it's too complicated.
That sounds nice. What I meant was: why not use the current tech which is able to display properly the text in HTML, and just render everything that is not text in SVG (as currently done for the background, nop?) ?
Sorry for the duplicate. So if I understand well, the issue is that you can easily output a page to SVG based on Cairo , but you can't easily remove part of the page (like text, for instance) and hence change what's rendered to SVG right ?
I've taken a look at the code of pdftocairo, the output is a multi-page SVG, which is not quite suitable for HTML. I have to make it an svg image per page. I even failed to that since pdftocairo supports a number of formats, and the code was kind of a mess.
I will give it another try will I have time again, but now I know that it is not trivial.
You can have a look at pdf2svg which does the same job as pdf2cairo but enables the creation of 1 SVG per page. I can try to work on this if you want. There's this very simple convertPage(PopplerPage page, const char svgFilename) which seems especially interesting to me. The only question is if it is possible to pass our context currently used for the background (ie the page without most of the text?) :
poppler_page_get_size (page, &width, &height);
// Open the SVG file
surface = cairo_svg_surface_create(svgFilename, width, height);
drawcontext = cairo_create(surface);
// Render the PDF file into the SVG file
// Close the SVG file
@iclems poppler_page_for_printing is just a simple wrapper of the CairoOutputDev interfaces. In order to remove the text, I guess we still need to work on CairoOutputDev, like what I did with SplashOutputDev.
But a problem is that this interface use its won Font embedding and text placement systems, but ideally we want it the same way as in HTML, more precisely, use @font-face and CSS to specify fonts. And I don't know how to do that.
There is a pretty old branch called bg_integrate, which saves my early attempt, you may want to take a quick glance, but the code was a mess.
You are very welcome to do it now, as I've marked this issue as future, which means I don't expect enough time working on this in a near future.
A (very) experimental implementation of SVG support is in the svg branch, which can be turned on with -DENABLE_SVG=ON cmake option. It disables the old png backend automatically.
Now the format can be specified at run time.
I guess this issue can be closed now.