diff --git a/pdf2htmlEX/share/pdf2htmlEX.js.in b/pdf2htmlEX/share/pdf2htmlEX.js.in index c0b04fb2..40ffde66 100644 --- a/pdf2htmlEX/share/pdf2htmlEX.js.in +++ b/pdf2htmlEX/share/pdf2htmlEX.js.in @@ -335,22 +335,6 @@ Viewer.prototype = { this.initialize_radio_button(); this.render(); - - { - // deal with delayed image loading - var images = document.getElementsByTagName('img'); - for (var i = 0; i < images.length; i++) { - var image = images[i]; - (function(image) { - image.addEventListener('error', function() { - setTimeout(function() { - image.src = image.src; - }, 1000); - }); - })(image); - image.src = image.src; - } - } }, /* diff --git a/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.cc b/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.cc index b349cb4c..4621db9b 100644 --- a/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.cc +++ b/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.cc @@ -130,10 +130,9 @@ bool CairoBackgroundRenderer::render_page(PDFDoc * doc, int pageno) if (doc->getPageRotate(pageno) == 90 || doc->getPageRotate(pageno) == 270) std::swap(page_height, page_width); - auto tmp_fn = html_renderer->str_fmt("%s/tmp_bg%x.svg", (param.embed_image ? param.tmp_dir : param.dest_dir).c_str(), pageno); auto fn = html_renderer->str_fmt("%s/bg%x.svg", (param.embed_image ? param.tmp_dir : param.dest_dir).c_str(), pageno); - surface = cairo_svg_surface_create((const char *)tmp_fn, page_width * param.actual_dpi / DEFAULT_DPI, page_height * param.actual_dpi / DEFAULT_DPI); + surface = cairo_svg_surface_create((const char *)fn, page_width * param.actual_dpi / DEFAULT_DPI, page_height * param.actual_dpi / DEFAULT_DPI); cairo_svg_surface_restrict_to_version(surface, CAIRO_SVG_VERSION_1_2); cairo_surface_set_fallback_resolution(surface, param.actual_dpi, param.actual_dpi); @@ -173,7 +172,7 @@ bool CairoBackgroundRenderer::render_page(PDFDoc * doc, int pageno) { int n = 0; char c; - ifstream svgfile((const char *)tmp_fn); + ifstream svgfile((const char *)fn); //count of '<' in the file should be an approximation of node count. while(svgfile >> c) { @@ -190,8 +189,6 @@ bool CairoBackgroundRenderer::render_page(PDFDoc * doc, int pageno) for (auto id : bitmaps_in_current_page) ++bitmaps_ref_count[id]; - std::rename((const char *)tmp_fn, (const char *)fn); - if(param.embed_image) html_renderer->tmp_files.add((const char *)fn); diff --git a/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc b/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc index 52859de6..780c008a 100644 --- a/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc +++ b/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc @@ -114,7 +114,6 @@ bool SplashBackgroundRenderer::render_page(PDFDoc * doc, int pageno) auto * bitmap = getBitmap(); - auto tmp_fn = html_renderer->str_fmt("%s/tmp_bg%x.%s", (param.embed_image ? param.tmp_dir : param.dest_dir).c_str(), pageno, format.c_str()); auto fn = html_renderer->str_fmt("%s/bg%x.%s", (param.embed_image ? param.tmp_dir : param.dest_dir).c_str(), pageno, format.c_str()); SplashImageFileFormat splashImageFileFormat; @@ -125,12 +124,10 @@ bool SplashBackgroundRenderer::render_page(PDFDoc * doc, int pageno) else throw string("Image format not supported: ") + format; - SplashError e = bitmap->writeImgFile(splashImageFileFormat, (const char *)tmp_fn, param.actual_dpi, param.actual_dpi); + SplashError e = bitmap->writeImgFile(splashImageFileFormat, (const char *)fn, param.actual_dpi, param.actual_dpi); if (e != splashOk) throw string("Cannot write background image. SplashErrorCode: ") + std::to_string(e); - std::rename((const char *)tmp_fn, (const char *)fn); - if(param.embed_image) html_renderer->tmp_files.add((const char *)fn);