diff --git a/src/HTMLRenderer.h b/src/HTMLRenderer.h
index e1eb406..10a99c4 100644
--- a/src/HTMLRenderer.h
+++ b/src/HTMLRenderer.h
@@ -223,6 +223,8 @@ class HTMLRenderer : public OutputDev
static const std::string NECK_HTML_FILENAME;
static const std::string TAIL_HTML_FILENAME;
static const std::string CSS_FILENAME;
+ static const std::string FONTFORGE_SCRIPT_FILENAME;
+ // for cross-platform purpose, use a "null" file instead of /dev/null
static const std::string NULL_FILENAME;
};
diff --git a/src/HTMLRenderer/general.cc b/src/HTMLRenderer/general.cc
index a393d7a..52909db 100644
--- a/src/HTMLRenderer/general.cc
+++ b/src/HTMLRenderer/general.cc
@@ -198,12 +198,18 @@ void HTMLRenderer::process_single_html()
void HTMLRenderer::add_tmp_file(const string & fn)
{
+ if(!param->clean_tmp)
+ return;
+
if(tmp_files.insert(fn).second && param->debug)
cerr << "Add new temporary file: " << fn << endl;
}
void HTMLRenderer::clean_tmp_files()
{
+ if(!param->clean_tmp)
+ return;
+
for(const auto & fn : tmp_files)
{
try
@@ -230,3 +236,4 @@ const std::string HTMLRenderer::NECK_HTML_FILENAME = "neck.html";
const std::string HTMLRenderer::TAIL_HTML_FILENAME = "tail.html";
const std::string HTMLRenderer::CSS_FILENAME = "all.css";
const std::string HTMLRenderer::NULL_FILENAME = "null";
+const std::string HTMLRenderer::FONTFORGE_SCRIPT_FILENAME = "pdf2htmlEX.pe";
diff --git a/src/HTMLRenderer/install.cc b/src/HTMLRenderer/install.cc
index 175e980..5af6852 100644
--- a/src/HTMLRenderer/install.cc
+++ b/src/HTMLRenderer/install.cc
@@ -119,9 +119,9 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
string fn = (format("f%|1$x|") % fn_id).str();
- path script_path = tmp_dir / "pdf2htmlEX.pe";
+ path script_path = tmp_dir / FONTFORGE_SCRIPT_FILENAME;
ofstream script_fout(script_path, ofstream::binary);
- add_tmp_file("pdf2htmlEX.pe");
+ add_tmp_file(FONTFORGE_SCRIPT_FILENAME);
script_fout << format("Open(%1%, 1)") % (tmp_dir / (fn + suffix)) << endl;
diff --git a/src/Param.h b/src/Param.h
index 9e7dafc..a22d177 100644
--- a/src/Param.h
+++ b/src/Param.h
@@ -25,10 +25,10 @@ struct Param
double h_eps, v_eps;
int process_nontext;
+ int single_html;
int debug;
-
- int single_html;
+ int clean_tmp;
};
diff --git a/src/pdf2htmlEX.cc b/src/pdf2htmlEX.cc
index 1effbe7..bf422d2 100644
--- a/src/pdf2htmlEX.cc
+++ b/src/pdf2htmlEX.cc
@@ -131,9 +131,10 @@ po::variables_map parse_options (int argc, char **argv)
("vdpi2", po::value(¶m.v_dpi2)->default_value(144.0), "vertical DPI for non-text")
("heps", po::value(¶m.h_eps)->default_value(1.0), "max tolerated horizontal offset (in pixels)")
("veps", po::value(¶m.v_eps)->default_value(1.0), "max tolerated vertical offset (in pixels)")
+ ("single-html", po::value(¶m.single_html)->default_value(1), "combine everything into one single HTML file")
("process-nontext", po::value(¶m.process_nontext)->default_value(1), "process nontext objects")
("debug", po::value(¶m.debug)->default_value(0), "output debug information")
- ("single-html", po::value(¶m.single_html)->default_value(1), "combine everything into one single HTML file")
+ ("clean-tmp", po::value(¶m.clean_tmp)->default_value(1), "clean temporary files after processing")
;
opt_hidden.add_options()