I use a little utility http://www.cityinthesky.co.uk/opensource/pdf2svg to render pdfs to svg and then edit them in Inkscape. The main function calls // Open the SVG file surface = cairo_svg_surface_create(svgFilename, width, height); drawcontext = cairo_create(surface); // Render the PDF file into the SVG file poppler_page_render(page, drawcontext); cairo_show_page(drawcontext); which, for many PDFs, generates "pixelated" output. By pixelated, I mean that rendering the character 'd' might be five boxes high for the rise and three boxes for the curve. So it looks like it has been rendered at low dpi. The following patch to poppler-page somewhat fixes it. By increasing the dpi rendered at we get much higher quality drawing, however the drawing is larger than the page of the generated svg (obviously, you might say). diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc index d1f1bcf..f744abd 100644 --- a/glib/poppler-page.cc +++ b/glib/poppler-page.cc @@ -348,7 +348,7 @@ _poppler_page_render (PopplerPage *page, * to get a bounding box */ cairo_save (cairo); page->page->displaySlice(output_dev, - 72.0, 72.0, 0, + 600.0, 600.0, 0, gFalse, /* useMediaBox */ gTrue, /* Crop */ -1, -1, So there's an issue, and I can debug it to some extent. However, I can imagine that changing the dpi being rendered to 600 might have performance implications for use cases other than my own. I'm sure you people out there in poppler land know how to fix this better than I. Note, this is observed using the latest poppler from git.
Well, I would say that the little tool you use is doing it wrong... Poppler_render is intended to produce a raster image, so using a svg cairo surface to render in it does not make sense. You should look at how other apps manage to convert from PDF to SVG. Probably there is a way of telling the CairoOutputDev in poppler core to render to a SVG surface, so you don't get pixels. Changing the dpi won't help as you are doing a VECTOR(PDF)->raster->Vector(SVG) where the raster step is clearly not needed.
sorry for the spam, but I figured my last comment is completely wrong... what should be happening here is that you are trying to convert a pdf that uses bitmapped fonts, then you'll have ``pixelation'' as cairo will internally convert the bitmapped glyphs to vectors when painting over the svg surface. I guess that If we wanted to support that, a solution would be to add like poppler_page_set_dpi or something similar to the glib bindings.
The documents are generated using pdflatex and use the standard tex fonts. Therefore, I don't think they are bitmapped fonts. So, this isn't failing for reasons of bitmapped fonts. The pdf2svg utility works for some PDFs that I pull of the 'net, but not for my latex generated documents. Furthermore, it used to work quite recently (I think up to about a month ago).
well, then maybe it's a problem in your pdflatex configuration. I know, since it has happened to me that pdflatex can use bitmapped fonts if the configuration files say so... and some update in my distro did that. So probably is best to upload two files, one that works, and one that does not. anyway, the question that stands is whether we need to add more api to the poppler glib bindings to support that (without breaking api or abi).
Thanks a lot. The problem was on my end, not in poppler.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.