@@ -130,10 +130,9 @@ bool CairoBackgroundRenderer::render_page(PDFDoc * doc, int pageno)
130130 if (doc->getPageRotate (pageno) == 90 || doc->getPageRotate (pageno) == 270 )
131131 std::swap (page_height, page_width);
132132
133- auto tmp_fn = html_renderer->str_fmt (" %s/tmp_bg%x.svg" , (param.embed_image ? param.tmp_dir : param.dest_dir ).c_str (), pageno);
134133 auto fn = html_renderer->str_fmt (" %s/bg%x.svg" , (param.embed_image ? param.tmp_dir : param.dest_dir ).c_str (), pageno);
135134
136- surface = cairo_svg_surface_create ((const char *)tmp_fn , page_width * param.actual_dpi / DEFAULT_DPI, page_height * param.actual_dpi / DEFAULT_DPI);
135+ surface = cairo_svg_surface_create ((const char *)fn , page_width * param.actual_dpi / DEFAULT_DPI, page_height * param.actual_dpi / DEFAULT_DPI);
137136 cairo_svg_surface_restrict_to_version (surface, CAIRO_SVG_VERSION_1_2);
138137 cairo_surface_set_fallback_resolution (surface, param.actual_dpi , param.actual_dpi );
139138
@@ -173,7 +172,7 @@ bool CairoBackgroundRenderer::render_page(PDFDoc * doc, int pageno)
173172 {
174173 int n = 0 ;
175174 char c;
176- ifstream svgfile ((const char *)tmp_fn );
175+ ifstream svgfile ((const char *)fn );
177176 // count of '<' in the file should be an approximation of node count.
178177 while (svgfile >> c)
179178 {
@@ -190,8 +189,6 @@ bool CairoBackgroundRenderer::render_page(PDFDoc * doc, int pageno)
190189 for (auto id : bitmaps_in_current_page)
191190 ++bitmaps_ref_count[id];
192191
193- std::rename ((const char *)tmp_fn, (const char *)fn);
194-
195192 if (param.embed_image )
196193 html_renderer->tmp_files .add ((const char *)fn);
197194
0 commit comments