mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 13:00:08 +00:00
Covered text handling: rename option name to --correct-text-visibility.
This commit is contained in:
parent
ceb4e3eac6
commit
85f04be632
@ -243,7 +243,7 @@ If set to 0, pdf2htmlEX would try its best to balance the two methods above.
|
|||||||
If set to 1, pdf2htmlEX will try to reduce the number of HTML elements used for text. Turn it off if anything goes wrong.
|
If set to 1, pdf2htmlEX will try to reduce the number of HTML elements used for text. Turn it off if anything goes wrong.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B --process-covered-text <0|1> (Default: 0)
|
.B --correct-text-visibility <0|1> (Default: 0)
|
||||||
If set to 1, pdf2htmlEX will try to detect texts covered by other graphics and properly arrange them,
|
If set to 1, pdf2htmlEX will try to detect texts covered by other graphics and properly arrange them,
|
||||||
i.e. covered texts are made transparent in text layer, and are drawn on background layer.
|
i.e. covered texts are made transparent in text layer, and are drawn on background layer.
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ void CairoBackgroundRenderer::drawChar(GfxState *state, double x, double y,
|
|||||||
}
|
}
|
||||||
// If a char is treated as image, it is not subject to cover test
|
// If a char is treated as image, it is not subject to cover test
|
||||||
// (see HTMLRenderer::drawString), so don't increase drawn_char_count.
|
// (see HTMLRenderer::drawString), so don't increase drawn_char_count.
|
||||||
else if (param.process_covered_text) {
|
else if (param.correct_text_visibility) {
|
||||||
if (html_renderer->is_char_covered(drawn_char_count))
|
if (html_renderer->is_char_covered(drawn_char_count))
|
||||||
CairoOutputDev::drawChar(state,x,y,dx,dy,originX,originY,code,nBytes,u,uLen);
|
CairoOutputDev::drawChar(state,x,y,dx,dy,originX,originY,code,nBytes,u,uLen);
|
||||||
drawn_char_count++;
|
drawn_char_count++;
|
||||||
|
@ -90,7 +90,7 @@ void SplashBackgroundRenderer::drawChar(GfxState *state, double x, double y,
|
|||||||
}
|
}
|
||||||
// If a char is treated as image, it is not subject to cover test
|
// If a char is treated as image, it is not subject to cover test
|
||||||
// (see HTMLRenderer::drawString), so don't increase drawn_char_count.
|
// (see HTMLRenderer::drawString), so don't increase drawn_char_count.
|
||||||
else if (param.process_covered_text) {
|
else if (param.correct_text_visibility) {
|
||||||
if (html_renderer->is_char_covered(drawn_char_count))
|
if (html_renderer->is_char_covered(drawn_char_count))
|
||||||
SplashOutputDev::drawChar(state,x,y,dx,dy,originX,originY,code,nBytes,u,uLen);
|
SplashOutputDev::drawChar(state,x,y,dx,dy,originX,originY,code,nBytes,u,uLen);
|
||||||
drawn_char_count++;
|
drawn_char_count++;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#define DT_DEBUG(x)
|
#define DT_DEBUG(x)
|
||||||
|
|
||||||
#if !ENABLE_SVG
|
#if !ENABLE_SVG
|
||||||
#warning "Cairo is disabled because ENABLE_SVG is off, --process-covered-text has limited functionality."
|
#warning "Cairo is disabled because ENABLE_SVG is off, --correct-text-visibility has limited functionality."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace pdf2htmlEX
|
namespace pdf2htmlEX
|
||||||
@ -34,7 +34,7 @@ DrawingTracer::~DrawingTracer()
|
|||||||
|
|
||||||
void DrawingTracer::reset(GfxState *state)
|
void DrawingTracer::reset(GfxState *state)
|
||||||
{
|
{
|
||||||
if (!param.process_covered_text)
|
if (!param.correct_text_visibility)
|
||||||
return;
|
return;
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ void DrawingTracer::finish()
|
|||||||
// and should trace ctm changes ourself (via cairo).
|
// and should trace ctm changes ourself (via cairo).
|
||||||
void DrawingTracer::update_ctm(GfxState *state, double m11, double m12, double m21, double m22, double m31, double m32)
|
void DrawingTracer::update_ctm(GfxState *state, double m11, double m12, double m21, double m22, double m31, double m32)
|
||||||
{
|
{
|
||||||
if (!param.process_covered_text)
|
if (!param.correct_text_visibility)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if ENABLE_SVG
|
#if ENABLE_SVG
|
||||||
@ -78,7 +78,7 @@ void DrawingTracer::update_ctm(GfxState *state, double m11, double m12, double m
|
|||||||
|
|
||||||
void DrawingTracer::clip(GfxState * state, bool even_odd)
|
void DrawingTracer::clip(GfxState * state, bool even_odd)
|
||||||
{
|
{
|
||||||
if (!param.process_covered_text)
|
if (!param.correct_text_visibility)
|
||||||
return;
|
return;
|
||||||
#if ENABLE_SVG
|
#if ENABLE_SVG
|
||||||
do_path(state, state->getPath());
|
do_path(state, state->getPath());
|
||||||
@ -89,14 +89,14 @@ void DrawingTracer::clip(GfxState * state, bool even_odd)
|
|||||||
|
|
||||||
void DrawingTracer::clip_to_stroke_path(GfxState * state)
|
void DrawingTracer::clip_to_stroke_path(GfxState * state)
|
||||||
{
|
{
|
||||||
if (!param.process_covered_text)
|
if (!param.correct_text_visibility)
|
||||||
return;
|
return;
|
||||||
// TODO cairo_stroke_to_path() ?
|
// TODO cairo_stroke_to_path() ?
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawingTracer::save()
|
void DrawingTracer::save()
|
||||||
{
|
{
|
||||||
if (!param.process_covered_text)
|
if (!param.correct_text_visibility)
|
||||||
return;
|
return;
|
||||||
#if ENABLE_SVG
|
#if ENABLE_SVG
|
||||||
cairo_save(cairo);
|
cairo_save(cairo);
|
||||||
@ -104,7 +104,7 @@ void DrawingTracer::save()
|
|||||||
}
|
}
|
||||||
void DrawingTracer::restore()
|
void DrawingTracer::restore()
|
||||||
{
|
{
|
||||||
if (!param.process_covered_text)
|
if (!param.correct_text_visibility)
|
||||||
return;
|
return;
|
||||||
#if ENABLE_SVG
|
#if ENABLE_SVG
|
||||||
cairo_restore(cairo);
|
cairo_restore(cairo);
|
||||||
@ -153,7 +153,7 @@ void DrawingTracer::do_path(GfxState * state, GfxPath * path)
|
|||||||
void DrawingTracer::stroke(GfxState * state)
|
void DrawingTracer::stroke(GfxState * state)
|
||||||
{
|
{
|
||||||
#if ENABLE_SVG
|
#if ENABLE_SVG
|
||||||
if (!param.process_covered_text)
|
if (!param.correct_text_visibility)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DT_DEBUG(printf("DrawingTracer::stroke\n"));
|
DT_DEBUG(printf("DrawingTracer::stroke\n"));
|
||||||
@ -221,7 +221,7 @@ void DrawingTracer::stroke(GfxState * state)
|
|||||||
|
|
||||||
void DrawingTracer::fill(GfxState * state, bool even_odd)
|
void DrawingTracer::fill(GfxState * state, bool even_odd)
|
||||||
{
|
{
|
||||||
if (!param.process_covered_text)
|
if (!param.correct_text_visibility)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if ENABLE_SVG
|
#if ENABLE_SVG
|
||||||
@ -301,7 +301,7 @@ void DrawingTracer::draw_char_bbox(GfxState * state, double * bbox)
|
|||||||
|
|
||||||
void DrawingTracer::draw_image(GfxState *state)
|
void DrawingTracer::draw_image(GfxState *state)
|
||||||
{
|
{
|
||||||
if (!param.process_covered_text)
|
if (!param.correct_text_visibility)
|
||||||
return;
|
return;
|
||||||
double bbox[4] {0, 0, 1, 1};
|
double bbox[4] {0, 0, 1, 1};
|
||||||
draw_non_char_bbox(state, bbox);
|
draw_non_char_bbox(state, bbox);
|
||||||
@ -309,7 +309,7 @@ void DrawingTracer::draw_image(GfxState *state)
|
|||||||
|
|
||||||
void DrawingTracer::draw_char(GfxState *state, double x, double y, double ax, double ay)
|
void DrawingTracer::draw_char(GfxState *state, double x, double y, double ax, double ay)
|
||||||
{
|
{
|
||||||
if (!param.process_covered_text)
|
if (!param.correct_text_visibility)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Matrix tm, itm;
|
Matrix tm, itm;
|
||||||
|
@ -508,8 +508,10 @@ void HTMLRenderer::prepare_text_line(GfxState * state)
|
|||||||
double rise_x, rise_y;
|
double rise_x, rise_y;
|
||||||
state->textTransformDelta(0, state->getRise(), &rise_x, &rise_y);
|
state->textTransformDelta(0, state->getRise(), &rise_x, &rise_y);
|
||||||
state->transform(state->getCurX() + rise_x, state->getCurY() + rise_y, &cur_line_state.x, &cur_line_state.y);
|
state->transform(state->getCurX() + rise_x, state->getCurY() + rise_y, &cur_line_state.x, &cur_line_state.y);
|
||||||
if (param.process_covered_text)
|
|
||||||
|
if (param.correct_text_visibility)
|
||||||
cur_line_state.first_char_index = get_char_count();
|
cur_line_state.first_char_index = get_char_count();
|
||||||
|
|
||||||
html_text_page.open_new_line(cur_line_state);
|
html_text_page.open_new_line(cur_line_state);
|
||||||
|
|
||||||
cur_text_state.vertical_align = 0;
|
cur_text_state.vertical_align = 0;
|
||||||
|
@ -38,7 +38,7 @@ struct Param
|
|||||||
int process_nontext;
|
int process_nontext;
|
||||||
int process_outline;
|
int process_outline;
|
||||||
int process_annotation;
|
int process_annotation;
|
||||||
int process_covered_text;
|
int correct_text_visibility;
|
||||||
int printing;
|
int printing;
|
||||||
int fallback;
|
int fallback;
|
||||||
int tmp_file_size_limit;
|
int tmp_file_size_limit;
|
||||||
|
@ -187,7 +187,7 @@ void parse_options (int argc, char **argv)
|
|||||||
.add("space-as-offset", ¶m.space_as_offset, 0, "treat space characters as offsets")
|
.add("space-as-offset", ¶m.space_as_offset, 0, "treat space characters as offsets")
|
||||||
.add("tounicode", ¶m.tounicode, 0, "how to handle ToUnicode CMaps (0=auto, 1=force, -1=ignore)")
|
.add("tounicode", ¶m.tounicode, 0, "how to handle ToUnicode CMaps (0=auto, 1=force, -1=ignore)")
|
||||||
.add("optimize-text", ¶m.optimize_text, 0, "try to reduce the number of HTML elements used for text")
|
.add("optimize-text", ¶m.optimize_text, 0, "try to reduce the number of HTML elements used for text")
|
||||||
.add("process-covered-text", ¶m.process_covered_text, 0, "try to detect texts covered by other graphics and properly arrange them")
|
.add("correct-text-visibility", ¶m.correct_text_visibility, 0, "try to detect texts covered by other graphics and properly arrange them")
|
||||||
|
|
||||||
// background image
|
// background image
|
||||||
.add("bg-format", ¶m.bg_format, "png", "specify background image format")
|
.add("bg-format", ¶m.bg_format, "png", "specify background image format")
|
||||||
|
Loading…
Reference in New Issue
Block a user