1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 04:50:09 +00:00

working on single HTML

This commit is contained in:
Lu Wang 2012-08-15 02:54:39 +08:00
parent 58eaeb8f22
commit dfb258c7a0
5 changed files with 8 additions and 14 deletions

View File

@ -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

View File

@ -34,10 +34,6 @@
/*
* Naming Convention
*
* ID
*
* p<hex> - Page
*
* CSS classes
*
* p - Page

View File

@ -123,24 +123,22 @@ void HTMLRenderer::startPage(int pageNum, GfxState *state)
assert(!line_opened);
html_fout << format("<div id=\"p%|1$x|\" class=\"p\">") % pageNum << endl;
html_fout << format("<div id=\"p%|1$x|\" class=\"p\" style=\"width:%2%px;height:%3%px;") % pageNum % pageWidth % pageHeight;
allcss_fout << format("#p%|1$x|{width:%2%px;height:%3%px;") % pageNum % pageWidth % pageHeight;
allcss_fout << "background-image:url(";
html_fout << "background-image:url(";
const std::string fn = (format("p%|1$x|.png") % pageNum).str();
if(param->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;

View File

@ -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);
}

View File

@ -132,7 +132,7 @@ po::variables_map parse_options (int argc, char **argv)
("veps", po::value<double>(&param.v_eps)->default_value(1.0), "max tolerated vertical offset (in pixels)")
("process-nontext", po::value<int>(&param.process_nontext)->default_value(1), "process nontext objects")
("debug", po::value<int>(&param.debug)->default_value(0), "output debug information")
("single-html", po::value<int>(&param.single_html)->default_value(0), "combine everything into one single HTML file")
("single-html", po::value<int>(&param.single_html)->default_value(1), "combine everything into one single HTML file")
;
opt_hidden.add_options()