1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-05 17:48:38 +00:00

Merge branch 'devv' of github.com:coolwanglu/pdf2htmlEX into devv

This commit is contained in:
Lu Wang 2012-08-18 22:11:35 +08:00
commit 922ae10132
10 changed files with 37 additions and 11 deletions

View File

@ -39,5 +39,5 @@ add_executable(pdf2htmlEX
target_link_libraries(pdf2htmlEX poppler boost_program_options boost_filesystem boost_system)
install (TARGETS pdf2htmlEX DESTINATION bin)
file (GLOB libfiles lib/*)
install (FILES ${libfiles} DESTINATION lib/pdf2htmlEX)
file (GLOB datafiles share/*)
install (FILES ${datafiles} DESTINATION share/pdf2htmlEX)

View File

@ -4,6 +4,10 @@ pdf2html**EX**
[**View Demo**](http://coolwanglu.github.com/pdf2htmlEX/demo/demo.html)
**WINDOWS XP USERS: Please make sure ClearType is turned on**
(Control Panel -> Display -> Appearance -> Effects -> "Use the following method to smooth edges of screen fonts" -> ClearType)
Introduction
-----------------------------
pdf2htmlEX renders PDF files in HTML, utilizing modern Web technologies, aims to provide an accuracy rendering, while keeping optimized for Web display.

View File

@ -112,19 +112,19 @@ void HTMLRenderer::pre_process()
html_fout.open(dest_dir / param->output_filename, ofstream::binary);
allcss_fout.open(dest_dir / CSS_FILENAME, ofstream::binary);
html_fout << ifstream(PDF2HTMLEX_LIB_PATH / HEAD_HTML_FILENAME, ifstream::binary).rdbuf();
html_fout << ifstream(PDF2HTMLEX_DATA_PATH / HEAD_HTML_FILENAME, ifstream::binary).rdbuf();
html_fout << "<link rel=\"stylesheet\" type=\"text/css\" href=\"" << CSS_FILENAME << "\"/>" << endl;
html_fout << ifstream(PDF2HTMLEX_LIB_PATH / NECK_HTML_FILENAME, ifstream::binary).rdbuf();
html_fout << ifstream(PDF2HTMLEX_DATA_PATH / NECK_HTML_FILENAME, ifstream::binary).rdbuf();
}
allcss_fout << ifstream(PDF2HTMLEX_LIB_PATH / CSS_FILENAME, ifstream::binary).rdbuf();
allcss_fout << ifstream(PDF2HTMLEX_DATA_PATH / CSS_FILENAME, ifstream::binary).rdbuf();
}
void HTMLRenderer::post_process()
{
if(!param->single_html)
{
html_fout << ifstream(PDF2HTMLEX_LIB_PATH / TAIL_HTML_FILENAME, ifstream::binary).rdbuf();
html_fout << ifstream(PDF2HTMLEX_DATA_PATH / TAIL_HTML_FILENAME, ifstream::binary).rdbuf();
}
html_fout.close();
@ -195,17 +195,17 @@ void HTMLRenderer::process_single_html()
{
ofstream out (dest_dir / param->output_filename, ofstream::binary);
out << ifstream(PDF2HTMLEX_LIB_PATH / HEAD_HTML_FILENAME , ifstream::binary).rdbuf();
out << ifstream(PDF2HTMLEX_DATA_PATH / HEAD_HTML_FILENAME , ifstream::binary).rdbuf();
out << "<style type=\"text/css\">" << endl;
out << ifstream(tmp_dir / CSS_FILENAME, ifstream::binary).rdbuf();
out << "</style>" << endl;
out << ifstream(PDF2HTMLEX_LIB_PATH / NECK_HTML_FILENAME, ifstream::binary).rdbuf();
out << ifstream(PDF2HTMLEX_DATA_PATH / NECK_HTML_FILENAME, ifstream::binary).rdbuf();
out << ifstream(tmp_dir / (param->output_filename + ".part"), ifstream::binary).rdbuf();
out << ifstream(PDF2HTMLEX_LIB_PATH / TAIL_HTML_FILENAME, ifstream::binary).rdbuf();
out << ifstream(PDF2HTMLEX_DATA_PATH / TAIL_HTML_FILENAME, ifstream::binary).rdbuf();
}
void HTMLRenderer::add_tmp_file(const string & fn)

View File

@ -14,7 +14,7 @@
static const std::string PDF2HTMLEX_VERSION = "@PDF2HTMLEX_VERSION@";
static const std::string PDF2HTMLEX_PREFIX = "@CMAKE_INSTALL_PREFIX@";
static const boost::filesystem::path PDF2HTMLEX_LIB_PATH = boost::filesystem::path(PDF2HTMLEX_PREFIX) / "lib" / "pdf2htmlEX";
static const boost::filesystem::path PDF2HTMLEX_DATA_PATH = boost::filesystem::path(PDF2HTMLEX_PREFIX) / "share" / "pdf2htmlEX";
#endif //CONFIG_H__

View File

@ -172,7 +172,7 @@ int main(int argc, char **argv)
//prepare the directories
for(const auto & p : {param.dest_dir, param.tmp_dir})
{
if(equivalent(PDF2HTMLEX_LIB_PATH, p))
if(equivalent(PDF2HTMLEX_DATA_PATH, p))
{
cerr << "The specified directory \"" << p << "\" is the library path for pdf2htmlEX. Please use another one." << endl;
return -1;

View File

@ -43,6 +43,28 @@ static inline bool _tm_equal(const double * tm1, const double * tm2, int size =
return true;
}
/*
* http://en.wikipedia.org/wiki/HTML_decimal_character_rendering
*/
static inline bool isLegalUnicode(Unicode u)
{
/*
if((u == 9) || (u == 10) || (u == 13))
return true;
*/
if(u <= 31)
return false;
if((u >= 127) && (u <= 159))
return false;
if((u >= 0xd800) && (u <= 0xdfff))
return false;
return true;
}
static inline void outputUnicodes(std::ostream & out, const Unicode * u, int uLen)
{
for(int i = 0; i < uLen; ++i)