diff --git a/.travis.yml b/.travis.yml index bcdfe40..6e1f218 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ compiler: gcc before_install: - sudo add-apt-repository ppa:coolwanglu/pdf2htmlex --yes - sudo apt-get update -qq - - sudo apt-get install -qq libpoppler-dev libspiro-dev libcairo-dev libfreetype6-dev + - sudo apt-get install -qq libpoppler-dev libspiro-dev libcairo-dev libfreetype6-dev libltdl-dev install: - export LIBRARY_PATH=/usr/local/lib - export LD_LIBRARY_PATH=/usr/local/lib diff --git a/ChangeLog b/ChangeLog index 184bfc8..b05e86a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,13 @@ Developing v0.12 * Do not support Fontforge < 2.0.0 any more +* New options + --process-annotation v0.11 2014.01.19 + * Compress JS with closure-compiler * Compress CSS with YUI Compressor * jQuery removed diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..64e4613 --- /dev/null +++ b/INSTALL @@ -0,0 +1,3 @@ +For instructions of building the source code, visit: +https://github.com/coolwanglu/pdf2htmlEX/wiki/Building + diff --git a/pdf2htmlEX.1.in b/pdf2htmlEX.1.in index 18c2f6c..8b01c34 100644 --- a/pdf2htmlEX.1.in +++ b/pdf2htmlEX.1.in @@ -134,6 +134,10 @@ Whether to process non-text objects (as images) .B --process-outline <0|1> (Default: 1) Whether to show outline in the generated HTML +.TP +.B --process-annotation <0|1> (Default: 0) +Whether to show annotation in the generated HTML + .TP .B --printing <0|1> (Default: 1) Enable printing support. Disabling this option may reduce the size of CSS. diff --git a/src/BackgroundRenderer/CairoBackgroundRenderer.cc b/src/BackgroundRenderer/CairoBackgroundRenderer.cc index a8bbebf..6a7f236 100644 --- a/src/BackgroundRenderer/CairoBackgroundRenderer.cc +++ b/src/BackgroundRenderer/CairoBackgroundRenderer.cc @@ -48,8 +48,8 @@ void CairoBackgroundRenderer::init(PDFDoc * doc) startDoc(doc); } -static GBool annot_cb(Annot *, void *) { - return false; +static GBool annot_cb(Annot *, void * pflag) { + return (*((bool*)pflag)) ? gTrue : gFalse; }; void CairoBackgroundRenderer::render_page(PDFDoc * doc, int pageno) @@ -81,12 +81,13 @@ void CairoBackgroundRenderer::render_page(PDFDoc * doc, int pageno) setCairo(cr); setPrinting(false); + bool process_annotation = param.process_annotation; doc->displayPage(this, pageno, param.h_dpi, param.v_dpi, 0, (!(param.use_cropbox)), false, false, - nullptr, nullptr, &annot_cb, nullptr); + nullptr, nullptr, &annot_cb, &process_annotation); setCairo(nullptr); diff --git a/src/BackgroundRenderer/SplashBackgroundRenderer.cc b/src/BackgroundRenderer/SplashBackgroundRenderer.cc index dfe248d..0e42b32 100644 --- a/src/BackgroundRenderer/SplashBackgroundRenderer.cc +++ b/src/BackgroundRenderer/SplashBackgroundRenderer.cc @@ -72,17 +72,18 @@ void SplashBackgroundRenderer::init(PDFDoc * doc) startDoc(doc); } -static GBool annot_cb(Annot *, void *) { - return false; +static GBool annot_cb(Annot *, void * pflag) { + return (*((bool*)pflag)) ? gTrue : gFalse; }; void SplashBackgroundRenderer::render_page(PDFDoc * doc, int pageno) { + bool process_annotation = param.process_annotation; doc->displayPage(this, pageno, param.h_dpi, param.v_dpi, 0, (!(param.use_cropbox)), false, false, - nullptr, nullptr, &annot_cb, nullptr); + nullptr, nullptr, &annot_cb, &process_annotation); } void SplashBackgroundRenderer::embed_image(int pageno) diff --git a/src/HTMLTextLine.cc b/src/HTMLTextLine.cc index 8f94627..8e63226 100644 --- a/src/HTMLTextLine.cc +++ b/src/HTMLTextLine.cc @@ -472,17 +472,14 @@ void HTMLTextLine::optimize_normal(std::vector & lines) // for optimize-text == 3 void HTMLTextLine::optimize_aggressive(std::vector & lines) { + /* HTMLLineState original_line_state = line_state; // break the line if there are a large (positive or negative) shift // letter space / word space are not taken into consideration (yet) while(true) { - - - } - /* // aggressive optimization if(target > state_iter1->em_size() * (param.space_threshold) - EPS) out << ' '; diff --git a/src/Param.h b/src/Param.h index 096d64b..9d42620 100644 --- a/src/Param.h +++ b/src/Param.h @@ -37,6 +37,7 @@ struct Param std::string outline_filename; int process_nontext; int process_outline; + int process_annotation; int printing; int fallback; int tmp_file_size_limit; diff --git a/src/pdf2htmlEX.cc b/src/pdf2htmlEX.cc index 257eba5..5dbd49f 100644 --- a/src/pdf2htmlEX.cc +++ b/src/pdf2htmlEX.cc @@ -163,6 +163,7 @@ void parse_options (int argc, char **argv) .add("outline-filename", ¶m.outline_filename, "", "filename of the generated outline file") .add("process-nontext", ¶m.process_nontext, 1, "render graphics in addition to text") .add("process-outline", ¶m.process_outline, 1, "show outline in HTML") + .add("process-annotation", ¶m.process_annotation, 0, "show annotation in HTML") .add("printing", ¶m.printing, 1, "enable printing support") .add("fallback", ¶m.fallback, 0, "output in fallback mode") .add("tmp-file-size-limit", ¶m.tmp_file_size_limit, -1, "Maximum size (in KB) used by temporary files, -1 for no limit.")