[Poppler-bugs] [Bug 38960] New: Rendering PDF to SVG is "pixelated"

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Jul 4 14:14:40 PDT 2011


https://bugs.freedesktop.org/show_bug.cgi?id=38960

           Summary: Rendering PDF to SVG is "pixelated"
           Product: poppler
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: general
        AssignedTo: poppler-bugs at lists.freedesktop.org
        ReportedBy: aidan at phoric.eu


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.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Poppler-bugs mailing list