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

new option: --process-annotation

This commit is contained in:
Lu Wang 2014-06-06 21:43:53 -07:00
parent 1a3490078c
commit c4aa9cb384
9 changed files with 22 additions and 11 deletions

View File

@ -3,7 +3,7 @@ compiler: gcc
before_install: before_install:
- sudo add-apt-repository ppa:coolwanglu/pdf2htmlex --yes - sudo add-apt-repository ppa:coolwanglu/pdf2htmlex --yes
- sudo apt-get update -qq - 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: install:
- export LIBRARY_PATH=/usr/local/lib - export LIBRARY_PATH=/usr/local/lib
- export LD_LIBRARY_PATH=/usr/local/lib - export LD_LIBRARY_PATH=/usr/local/lib

View File

@ -1,10 +1,13 @@
Developing v0.12 Developing v0.12
* Do not support Fontforge < 2.0.0 any more * Do not support Fontforge < 2.0.0 any more
* New options
--process-annotation
v0.11 v0.11
2014.01.19 2014.01.19
* Compress JS with closure-compiler * Compress JS with closure-compiler
* Compress CSS with YUI Compressor * Compress CSS with YUI Compressor
* jQuery removed * jQuery removed

3
INSTALL Normal file
View File

@ -0,0 +1,3 @@
For instructions of building the source code, visit:
https://github.com/coolwanglu/pdf2htmlEX/wiki/Building

View File

@ -134,6 +134,10 @@ Whether to process non-text objects (as images)
.B --process-outline <0|1> (Default: 1) .B --process-outline <0|1> (Default: 1)
Whether to show outline in the generated HTML 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 .TP
.B --printing <0|1> (Default: 1) .B --printing <0|1> (Default: 1)
Enable printing support. Disabling this option may reduce the size of CSS. Enable printing support. Disabling this option may reduce the size of CSS.

View File

@ -48,8 +48,8 @@ void CairoBackgroundRenderer::init(PDFDoc * doc)
startDoc(doc); startDoc(doc);
} }
static GBool annot_cb(Annot *, void *) { static GBool annot_cb(Annot *, void * pflag) {
return false; return (*((bool*)pflag)) ? gTrue : gFalse;
}; };
void CairoBackgroundRenderer::render_page(PDFDoc * doc, int pageno) void CairoBackgroundRenderer::render_page(PDFDoc * doc, int pageno)
@ -81,12 +81,13 @@ void CairoBackgroundRenderer::render_page(PDFDoc * doc, int pageno)
setCairo(cr); setCairo(cr);
setPrinting(false); setPrinting(false);
bool process_annotation = param.process_annotation;
doc->displayPage(this, pageno, param.h_dpi, param.v_dpi, doc->displayPage(this, pageno, param.h_dpi, param.v_dpi,
0, 0,
(!(param.use_cropbox)), (!(param.use_cropbox)),
false, false,
false, false,
nullptr, nullptr, &annot_cb, nullptr); nullptr, nullptr, &annot_cb, &process_annotation);
setCairo(nullptr); setCairo(nullptr);

View File

@ -72,17 +72,18 @@ void SplashBackgroundRenderer::init(PDFDoc * doc)
startDoc(doc); startDoc(doc);
} }
static GBool annot_cb(Annot *, void *) { static GBool annot_cb(Annot *, void * pflag) {
return false; return (*((bool*)pflag)) ? gTrue : gFalse;
}; };
void SplashBackgroundRenderer::render_page(PDFDoc * doc, int pageno) void SplashBackgroundRenderer::render_page(PDFDoc * doc, int pageno)
{ {
bool process_annotation = param.process_annotation;
doc->displayPage(this, pageno, param.h_dpi, param.v_dpi, doc->displayPage(this, pageno, param.h_dpi, param.v_dpi,
0, 0,
(!(param.use_cropbox)), (!(param.use_cropbox)),
false, false, false, false,
nullptr, nullptr, &annot_cb, nullptr); nullptr, nullptr, &annot_cb, &process_annotation);
} }
void SplashBackgroundRenderer::embed_image(int pageno) void SplashBackgroundRenderer::embed_image(int pageno)

View File

@ -472,17 +472,14 @@ void HTMLTextLine::optimize_normal(std::vector<HTMLTextLine*> & lines)
// for optimize-text == 3 // for optimize-text == 3
void HTMLTextLine::optimize_aggressive(std::vector<HTMLTextLine*> & lines) void HTMLTextLine::optimize_aggressive(std::vector<HTMLTextLine*> & lines)
{ {
/*
HTMLLineState original_line_state = line_state; HTMLLineState original_line_state = line_state;
// break the line if there are a large (positive or negative) shift // break the line if there are a large (positive or negative) shift
// letter space / word space are not taken into consideration (yet) // letter space / word space are not taken into consideration (yet)
while(true) while(true)
{ {
} }
/*
// aggressive optimization // aggressive optimization
if(target > state_iter1->em_size() * (param.space_threshold) - EPS) if(target > state_iter1->em_size() * (param.space_threshold) - EPS)
out << ' '; out << ' ';

View File

@ -37,6 +37,7 @@ struct Param
std::string outline_filename; std::string outline_filename;
int process_nontext; int process_nontext;
int process_outline; int process_outline;
int process_annotation;
int printing; int printing;
int fallback; int fallback;
int tmp_file_size_limit; int tmp_file_size_limit;

View File

@ -163,6 +163,7 @@ void parse_options (int argc, char **argv)
.add("outline-filename", &param.outline_filename, "", "filename of the generated outline file") .add("outline-filename", &param.outline_filename, "", "filename of the generated outline file")
.add("process-nontext", &param.process_nontext, 1, "render graphics in addition to text") .add("process-nontext", &param.process_nontext, 1, "render graphics in addition to text")
.add("process-outline", &param.process_outline, 1, "show outline in HTML") .add("process-outline", &param.process_outline, 1, "show outline in HTML")
.add("process-annotation", &param.process_annotation, 0, "show annotation in HTML")
.add("printing", &param.printing, 1, "enable printing support") .add("printing", &param.printing, 1, "enable printing support")
.add("fallback", &param.fallback, 0, "output in fallback mode") .add("fallback", &param.fallback, 0, "output in fallback mode")
.add("tmp-file-size-limit", &param.tmp_file_size_limit, -1, "Maximum size (in KB) used by temporary files, -1 for no limit.") .add("tmp-file-size-limit", &param.tmp_file_size_limit, -1, "Maximum size (in KB) used by temporary files, -1 for no limit.")