1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-04 17:18:40 +00:00

Merge pull request #280 from dsablic/master

Honor vdpi and hdpi parameters with SVG background output
This commit is contained in:
Lu Wang 2014-01-09 04:13:20 -08:00
commit e817550ed5
2 changed files with 3 additions and 14 deletions

View File

@ -5,6 +5,7 @@ Contributors:
Chris Cinelli <chris@allestelle.com>
Daniel Bonniot de Ruisselet <dbonniot@chemaxon.com>
Deepak <iapain@gmail.com>
Denis Sablic <denis.sablic@gmail.com>
filodej <philode@gmail.com>
hasufell <julian.ospald@googlemail.com>
Herbert Jones <herbert@mediafire.com>

View File

@ -72,32 +72,21 @@ void CairoBackgroundRenderer::render_page(PDFDoc * doc, int pageno)
if(param.embed_image)
html_renderer->tmp_files.add((char*)fn);
surface = cairo_svg_surface_create((char*)fn, page_width * DEFAULT_DPI, page_height * DEFAULT_DPI);
surface = cairo_svg_surface_create((char*)fn, page_width * param.h_dpi / DEFAULT_DPI, page_height * param.v_dpi / DEFAULT_DPI);
}
cairo_svg_surface_restrict_to_version(surface, CAIRO_SVG_VERSION_1_2);
cairo_surface_set_fallback_resolution(surface, param.h_dpi, param.v_dpi);
cairo_t * cr = cairo_create(surface);
setCairo(cr);
setPrinting(false); // TODO, check the parameter
cairo_save(cr);
// zoom the image to prevent CairoOutputDev from rounding/increasing thin borders
{
cairo_matrix_t matrix;
cairo_matrix_init_identity(&matrix);
cairo_matrix_scale(&matrix, DEFAULT_DPI, DEFAULT_DPI);
cairo_transform(cr, &matrix);
}
doc->displayPage(this, pageno, DEFAULT_DPI, DEFAULT_DPI,
doc->displayPage(this, pageno, param.h_dpi, param.v_dpi,
0,
(!(param.use_cropbox)),
false,
false,
nullptr, nullptr, &annot_cb, nullptr);
cairo_restore(cr);
setCairo(nullptr);
{
@ -107,7 +96,6 @@ void CairoBackgroundRenderer::render_page(PDFDoc * doc, int pageno)
throw string("Cairo error: ") + cairo_status_to_string(status);
}
// cairo_surface_show_page(surface);
cairo_surface_finish(surface);
{
auto status = cairo_surface_status(surface);