mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 13:00:08 +00:00
Merge branch 'devv' of github.com:coolwanglu/pdf2htmlEX into devv
This commit is contained in:
commit
922ae10132
@ -39,5 +39,5 @@ add_executable(pdf2htmlEX
|
|||||||
target_link_libraries(pdf2htmlEX poppler boost_program_options boost_filesystem boost_system)
|
target_link_libraries(pdf2htmlEX poppler boost_program_options boost_filesystem boost_system)
|
||||||
|
|
||||||
install (TARGETS pdf2htmlEX DESTINATION bin)
|
install (TARGETS pdf2htmlEX DESTINATION bin)
|
||||||
file (GLOB libfiles lib/*)
|
file (GLOB datafiles share/*)
|
||||||
install (FILES ${libfiles} DESTINATION lib/pdf2htmlEX)
|
install (FILES ${datafiles} DESTINATION share/pdf2htmlEX)
|
||||||
|
@ -4,6 +4,10 @@ pdf2html**EX**
|
|||||||
|
|
||||||
[**View Demo**](http://coolwanglu.github.com/pdf2htmlEX/demo/demo.html)
|
[**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
|
Introduction
|
||||||
-----------------------------
|
-----------------------------
|
||||||
pdf2htmlEX renders PDF files in HTML, utilizing modern Web technologies, aims to provide an accuracy rendering, while keeping optimized for Web display.
|
pdf2htmlEX renders PDF files in HTML, utilizing modern Web technologies, aims to provide an accuracy rendering, while keeping optimized for Web display.
|
||||||
|
@ -112,19 +112,19 @@ void HTMLRenderer::pre_process()
|
|||||||
html_fout.open(dest_dir / param->output_filename, ofstream::binary);
|
html_fout.open(dest_dir / param->output_filename, ofstream::binary);
|
||||||
allcss_fout.open(dest_dir / CSS_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 << "<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()
|
void HTMLRenderer::post_process()
|
||||||
{
|
{
|
||||||
if(!param->single_html)
|
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();
|
html_fout.close();
|
||||||
@ -195,17 +195,17 @@ void HTMLRenderer::process_single_html()
|
|||||||
{
|
{
|
||||||
ofstream out (dest_dir / param->output_filename, ofstream::binary);
|
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 << "<style type=\"text/css\">" << endl;
|
||||||
out << ifstream(tmp_dir / CSS_FILENAME, ifstream::binary).rdbuf();
|
out << ifstream(tmp_dir / CSS_FILENAME, ifstream::binary).rdbuf();
|
||||||
out << "</style>" << endl;
|
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(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)
|
void HTMLRenderer::add_tmp_file(const string & fn)
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
static const std::string PDF2HTMLEX_VERSION = "@PDF2HTMLEX_VERSION@";
|
static const std::string PDF2HTMLEX_VERSION = "@PDF2HTMLEX_VERSION@";
|
||||||
static const std::string PDF2HTMLEX_PREFIX = "@CMAKE_INSTALL_PREFIX@";
|
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__
|
#endif //CONFIG_H__
|
||||||
|
@ -172,7 +172,7 @@ int main(int argc, char **argv)
|
|||||||
//prepare the directories
|
//prepare the directories
|
||||||
for(const auto & p : {param.dest_dir, param.tmp_dir})
|
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;
|
cerr << "The specified directory \"" << p << "\" is the library path for pdf2htmlEX. Please use another one." << endl;
|
||||||
return -1;
|
return -1;
|
||||||
|
22
src/util.h
22
src/util.h
@ -43,6 +43,28 @@ static inline bool _tm_equal(const double * tm1, const double * tm2, int size =
|
|||||||
return true;
|
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)
|
static inline void outputUnicodes(std::ostream & out, const Unicode * u, int uLen)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < uLen; ++i)
|
for(int i = 0; i < uLen; ++i)
|
||||||
|
Loading…
Reference in New Issue
Block a user