From dfb258c7a00dbfbf54dc9d0167fdeffc9726956d Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Wed, 15 Aug 2012 02:54:39 +0800 Subject: [PATCH] working on single HTML --- README.md | 2 +- src/HTMLRenderer.h | 4 ---- src/HTMLRenderer/general.cc | 12 +++++------- src/HTMLRenderer/install.cc | 2 +- src/pdf2htmlEX.cc | 2 +- 5 files changed, 8 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 4464285..d51c909 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ This program is designed for scientific papers with complicate formulas and figu Features ---------------------------- +* Single HTML file output * Precise rendering * Text Selection * Font embedding @@ -41,7 +42,6 @@ HOW TO USE ---------------------------- pdf2htmlEX /path/to/sample.pdf - LICENSE ---------------------------- GPLv3 diff --git a/src/HTMLRenderer.h b/src/HTMLRenderer.h index 70a6722..e6c6cc2 100644 --- a/src/HTMLRenderer.h +++ b/src/HTMLRenderer.h @@ -34,10 +34,6 @@ /* * Naming Convention * - * ID - * - * p - Page - * * CSS classes * * p - Page diff --git a/src/HTMLRenderer/general.cc b/src/HTMLRenderer/general.cc index fa05ee1..0373168 100644 --- a/src/HTMLRenderer/general.cc +++ b/src/HTMLRenderer/general.cc @@ -123,24 +123,22 @@ void HTMLRenderer::startPage(int pageNum, GfxState *state) assert(!line_opened); - html_fout << format("
") % pageNum << endl; + html_fout << format("
single_html) { auto path = tmp_dir / fn; - allcss_fout << "'data:image/png;base64," << base64_filter(ifstream(path, ifstream::binary)) << "'"; + html_fout << "'data:image/png;base64," << base64_filter(ifstream(path, ifstream::binary)) << "'"; } else { - allcss_fout << fn; + html_fout << fn; } - allcss_fout << format(");background-position:0 0;background-size:%1%px %2%px;background-repeat:no-repeat;}") % pageWidth % pageHeight; + html_fout << format(");background-position:0 0;background-size:%1%px %2%px;background-repeat:no-repeat;\">") % pageWidth % pageHeight; cur_fn_id = cur_fs_id = cur_tm_id = cur_color_id = 0; cur_tx = cur_ty = 0; diff --git a/src/HTMLRenderer/install.cc b/src/HTMLRenderer/install.cc index eab1546..aa695ce 100644 --- a/src/HTMLRenderer/install.cc +++ b/src/HTMLRenderer/install.cc @@ -182,7 +182,7 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix, script_fout << format("Generate(%1%)") % (working_dir() / (fn+".ttf")) << endl; - system((boost::format("fontforge -script %1% 2>") % script_path).str().c_str()); + system((boost::format("fontforge -script %1% 2>%2%") % script_path % (tmp_dir / "log.txt")).str().c_str()); export_remote_font(fn_id, ".ttf", "truetype", font); } diff --git a/src/pdf2htmlEX.cc b/src/pdf2htmlEX.cc index a25dc34..6d1d019 100644 --- a/src/pdf2htmlEX.cc +++ b/src/pdf2htmlEX.cc @@ -132,7 +132,7 @@ po::variables_map parse_options (int argc, char **argv) ("veps", po::value(¶m.v_eps)->default_value(1.0), "max tolerated vertical offset (in pixels)") ("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(0), "combine everything into one single HTML file") + ("single-html", po::value(¶m.single_html)->default_value(1), "combine everything into one single HTML file") ; opt_hidden.add_options()