Low resolution when rendering a page using glib API
Hello,
The cairo surface produced by poppler is always at low resolution / poor quality when using glib API poppler_page_render() or poppler_page_render_for_printing(). Exemples and test source code in attached files :
After digging into the code, this is because the glib API always force a 72.0 DPI inside fct _poppler_page_render() :
page->page->displaySlice(output_dev, 72.0, 72.0, 0, false, /* useMediaBox */ true, /* Crop */ -1, -1, -1, -1, printing, nullptr, nullptr, printing ? poppler_print_annot_cb : nullptr, printing ? GINT_TO_POINTER((gint)print_flags) : nullptr);
visible in master and latest branch (poppler-21.09.0).
Function poppler_page_render and therefore _poppler_page_render() may have new parameters (xres, yres) passed to displaySlice() to deal with this problem. Poppler CPP API already operate this way with function render_page(). To avoid breaking change for existing programs, new functions may be added to set resolution (instead of creating new parameters ?).