mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 04:50:09 +00:00
TODO
This commit is contained in:
parent
779c91f81e
commit
2b06319207
5
TODO
5
TODO
@ -1,3 +1,6 @@
|
|||||||
|
Integrate splash/cairo
|
||||||
|
native support for image
|
||||||
|
native support for draw
|
||||||
|
|
||||||
about glyph width:
|
about glyph width:
|
||||||
- IE
|
- IE
|
||||||
@ -29,5 +32,3 @@ combine lines (unwarp)
|
|||||||
Printing
|
Printing
|
||||||
multiple charcode mapped to a same glyph
|
multiple charcode mapped to a same glyph
|
||||||
check if we can add information to the font, and let browsers show ligatures automatically
|
check if we can add information to the font, and let browsers show ligatures automatically
|
||||||
native support for image
|
|
||||||
native support for draw
|
|
||||||
|
@ -48,6 +48,8 @@ static bool is_rectangle(GfxSubpath * path)
|
|||||||
//TODO connection style
|
//TODO connection style
|
||||||
void HTMLRenderer::css_draw(GfxState *state, bool fill)
|
void HTMLRenderer::css_draw(GfxState *state, bool fill)
|
||||||
{
|
{
|
||||||
|
if(!(param->css_draw)) return;
|
||||||
|
|
||||||
GfxPath * path = state->getPath();
|
GfxPath * path = state->getPath();
|
||||||
for(int i = 0; i < path->getNumSubpaths(); ++i)
|
for(int i = 0; i < path->getNumSubpaths(); ++i)
|
||||||
{
|
{
|
||||||
@ -120,7 +122,28 @@ void HTMLRenderer::css_draw_rectangle(double x, double y, double w, double h,
|
|||||||
{
|
{
|
||||||
close_text_line();
|
close_text_line();
|
||||||
|
|
||||||
html_fout << "<div class=\"Cd t" << install_transform_matrix(state->getCTM()) << "\" style=\"";
|
double ctm[6];
|
||||||
|
memcpy(ctm, state->getCTM(), sizeof(ctm));
|
||||||
|
|
||||||
|
_transform(ctm, x, y);
|
||||||
|
|
||||||
|
double scale = 1.0;
|
||||||
|
{
|
||||||
|
double i1 = ctm[0] + ctm[2];
|
||||||
|
double i2 = ctm[1] + ctm[3];
|
||||||
|
scale = sqrt((i1 * i1 + i2 * i2) / 2.0);
|
||||||
|
if(_is_positive(scale))
|
||||||
|
{
|
||||||
|
for(int i = 0; i < 4; ++i)
|
||||||
|
ctm[i] /= scale;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scale = 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
html_fout << "<div class=\"Cd t" << install_transform_matrix(ctm) << "\" style=\"";
|
||||||
|
|
||||||
if(line_color)
|
if(line_color)
|
||||||
{
|
{
|
||||||
@ -131,9 +154,9 @@ void HTMLRenderer::css_draw_rectangle(double x, double y, double w, double h,
|
|||||||
{
|
{
|
||||||
if(i > 0) html_fout << ' ';
|
if(i > 0) html_fout << ' ';
|
||||||
|
|
||||||
double lw = line_width_array[i];
|
double lw = line_width_array[i] * scale;
|
||||||
html_fout << _round(lw);
|
html_fout << _round(lw);
|
||||||
if(lw > EPS) html_fout << "px";
|
if(_is_positive(lw)) html_fout << "px";
|
||||||
}
|
}
|
||||||
html_fout << ";";
|
html_fout << ";";
|
||||||
}
|
}
|
||||||
@ -151,12 +174,10 @@ void HTMLRenderer::css_draw_rectangle(double x, double y, double w, double h,
|
|||||||
html_fout << "background-color:transparent;";
|
html_fout << "background-color:transparent;";
|
||||||
}
|
}
|
||||||
|
|
||||||
_transform(state->getCTM(), x, y);
|
|
||||||
|
|
||||||
html_fout << "bottom:" << _round(y) << "px;"
|
html_fout << "bottom:" << _round(y) << "px;"
|
||||||
<< "left:" << _round(x) << "px;"
|
<< "left:" << _round(x) << "px;"
|
||||||
<< "width:" << _round(w) << "px;"
|
<< "width:" << _round(w * scale) << "px;"
|
||||||
<< "height:" << _round(h) << "px;";
|
<< "height:" << _round(h * scale) << "px;";
|
||||||
|
|
||||||
html_fout << "\"></div>";
|
html_fout << "\"></div>";
|
||||||
}
|
}
|
||||||
|
@ -84,17 +84,17 @@ void HTMLRenderer::process(PDFDoc *doc)
|
|||||||
|
|
||||||
vector<double> zoom_factors;
|
vector<double> zoom_factors;
|
||||||
|
|
||||||
if(abs(param->zoom) > EPS)
|
if(_is_positive(param->zoom))
|
||||||
{
|
{
|
||||||
zoom_factors.push_back(param->zoom);
|
zoom_factors.push_back(param->zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(abs(param->fit_width) > EPS)
|
if(_is_positive(param->fit_width))
|
||||||
{
|
{
|
||||||
zoom_factors.push_back((param->fit_width) / preprocessor.get_max_width());
|
zoom_factors.push_back((param->fit_width) / preprocessor.get_max_width());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(abs(param->fit_height) > EPS)
|
if(_is_positive(param->fit_height))
|
||||||
{
|
{
|
||||||
zoom_factors.push_back((param->fit_height) / preprocessor.get_max_height());
|
zoom_factors.push_back((param->fit_height) / preprocessor.get_max_height());
|
||||||
}
|
}
|
||||||
|
@ -206,13 +206,13 @@ void HTMLRenderer::check_state_change(GfxState * state)
|
|||||||
|
|
||||||
if(_equal(cur_text_tm[0] * tdy, cur_text_tm[1] * tdx))
|
if(_equal(cur_text_tm[0] * tdy, cur_text_tm[1] * tdx))
|
||||||
{
|
{
|
||||||
if(abs(cur_text_tm[0]) > EPS)
|
if(_is_positive(cur_text_tm[0]))
|
||||||
{
|
{
|
||||||
draw_tx += tdx / cur_text_tm[0];
|
draw_tx += tdx / cur_text_tm[0];
|
||||||
draw_ty += dy;
|
draw_ty += dy;
|
||||||
merged = true;
|
merged = true;
|
||||||
}
|
}
|
||||||
else if (abs(cur_text_tm[1]) > EPS)
|
else if (_is_positive(cur_text_tm[1]))
|
||||||
{
|
{
|
||||||
draw_tx += tdy / cur_text_tm[1];
|
draw_tx += tdy / cur_text_tm[1];
|
||||||
draw_ty += dy;
|
draw_ty += dy;
|
||||||
@ -220,7 +220,7 @@ void HTMLRenderer::check_state_change(GfxState * state)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if((abs(tdx) < EPS) && (abs(tdy) < EPS))
|
if((_equal(tdx,0)) && (_equal(tdy,0)))
|
||||||
{
|
{
|
||||||
// free
|
// free
|
||||||
draw_tx = cur_tx;
|
draw_tx = cur_tx;
|
||||||
|
@ -55,6 +55,9 @@ struct Param
|
|||||||
|
|
||||||
int debug;
|
int debug;
|
||||||
int clean_tmp;
|
int clean_tmp;
|
||||||
|
|
||||||
|
// experimental
|
||||||
|
int css_draw;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace pdf2htmlEX
|
} // namespace pdf2htmlEX
|
||||||
|
@ -91,6 +91,7 @@ void parse_options (int argc, char **argv)
|
|||||||
|
|
||||||
.add("debug", ¶m.debug, 0, "output debug information")
|
.add("debug", ¶m.debug, 0, "output debug information")
|
||||||
.add("clean-tmp", ¶m.clean_tmp, 1, "clean temporary files after processing")
|
.add("clean-tmp", ¶m.clean_tmp, 1, "clean temporary files after processing")
|
||||||
|
.add("css-draw", ¶m.css_draw, 0, "[Experimental and Unsupported] CSS Drawing")
|
||||||
.add("", ¶m.input_filename, "", "")
|
.add("", ¶m.input_filename, "", "")
|
||||||
.add("", ¶m.output_filename, "", "")
|
.add("", ¶m.output_filename, "", "")
|
||||||
;
|
;
|
||||||
|
Loading…
Reference in New Issue
Block a user