Skip to content

Commit f55e7ec

Browse files
committed
remove js reload; remove tmp image
1 parent 41c3300 commit f55e7ec

File tree

3 files changed

+3
-25
lines changed

3 files changed

+3
-25
lines changed

pdf2htmlEX/share/pdf2htmlEX.js.in

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -335,22 +335,6 @@ Viewer.prototype = {
335335

336336
this.initialize_radio_button();
337337
this.render();
338-
339-
{
340-
// deal with delayed image loading
341-
var images = document.getElementsByTagName('img');
342-
for (var i = 0; i < images.length; i++) {
343-
var image = images[i];
344-
(function(image) {
345-
image.addEventListener('error', function() {
346-
setTimeout(function() {
347-
image.src = image.src;
348-
}, 1000);
349-
});
350-
})(image);
351-
image.src = image.src;
352-
}
353-
}
354338
},
355339

356340
/*

pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ bool SplashBackgroundRenderer::render_page(PDFDoc * doc, int pageno)
114114

115115
auto * bitmap = getBitmap();
116116

117-
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());
118117
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());
119118

120119
SplashImageFileFormat splashImageFileFormat;
@@ -125,12 +124,10 @@ bool SplashBackgroundRenderer::render_page(PDFDoc * doc, int pageno)
125124
else
126125
throw string("Image format not supported: ") + format;
127126

128-
SplashError e = bitmap->writeImgFile(splashImageFileFormat, (const char *)tmp_fn, param.actual_dpi, param.actual_dpi);
127+
SplashError e = bitmap->writeImgFile(splashImageFileFormat, (const char *)fn, param.actual_dpi, param.actual_dpi);
129128
if (e != splashOk)
130129
throw string("Cannot write background image. SplashErrorCode: ") + std::to_string(e);
131130

132-
std::rename((const char *)tmp_fn, (const char *)fn);
133-
134131
if(param.embed_image)
135132
html_renderer->tmp_files.add((const char *)fn);
136133

0 commit comments

Comments
 (0)