mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-07-05 17:48:38 +00:00
more precise annot link border
This commit is contained in:
parent
af65485eb3
commit
866866f9d0
|
@ -56,6 +56,7 @@ HTMLRenderer::~HTMLRenderer()
|
||||||
}
|
}
|
||||||
|
|
||||||
static GBool annot_cb(Annot *, void *) {
|
static GBool annot_cb(Annot *, void *) {
|
||||||
|
return true;
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -296,28 +297,16 @@ void HTMLRenderer::processLink(AnnotLink * al)
|
||||||
html_fout << "<a href=\"" << dest_str << "\">";
|
html_fout << "<a href=\"" << dest_str << "\">";
|
||||||
}
|
}
|
||||||
|
|
||||||
double x1,x2,y1,y2;
|
html_fout << "<div style=\"";
|
||||||
al->getRect(&x1, &y1, &x2, &y2);
|
|
||||||
|
|
||||||
x1 = default_ctm[0] * x1 + default_ctm[2] * y1 + default_ctm[4];
|
|
||||||
y1 = default_ctm[1] * x1 + default_ctm[3] * y1 + default_ctm[5];
|
|
||||||
x2 = default_ctm[0] * x2 + default_ctm[2] * y2 + default_ctm[4];
|
|
||||||
y2 = default_ctm[1] * x2 + default_ctm[3] * y2 + default_ctm[5];
|
|
||||||
|
|
||||||
// TODO, in html, border width is included
|
|
||||||
html_fout << "<div style=\"position:absolute;"
|
|
||||||
<< "left:" << _round(x1) << "px;"
|
|
||||||
<< "bottom:" << _round(y1) << "px;"
|
|
||||||
<< "width:" << _round(x2-x1) << "px;"
|
|
||||||
<< "height:" << _round(y2-y1) << "px;";
|
|
||||||
|
|
||||||
|
double width = 0;
|
||||||
auto * border = al->getBorder();
|
auto * border = al->getBorder();
|
||||||
if(border)
|
if(border)
|
||||||
{
|
{
|
||||||
double w = border->getWidth();
|
width = border->getWidth() * (param->zoom);
|
||||||
if(w > 0)
|
if(width > 0)
|
||||||
{
|
{
|
||||||
html_fout << "border-width:" << _round(w) << "px;";
|
html_fout << "border-width:" << _round(width) << "px;";
|
||||||
auto style = border->getStyle();
|
auto style = border->getStyle();
|
||||||
switch(style)
|
switch(style)
|
||||||
{
|
{
|
||||||
|
@ -370,6 +359,22 @@ void HTMLRenderer::processLink(AnnotLink * al)
|
||||||
html_fout << "border-style:none;";
|
html_fout << "border-style:none;";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double x1,x2,y1,y2;
|
||||||
|
al->getRect(&x1, &y1, &x2, &y2);
|
||||||
|
|
||||||
|
x1 = default_ctm[0] * x1 + default_ctm[2] * y1 + default_ctm[4];
|
||||||
|
y1 = default_ctm[1] * x1 + default_ctm[3] * y1 + default_ctm[5];
|
||||||
|
x2 = default_ctm[0] * x2 + default_ctm[2] * y2 + default_ctm[4];
|
||||||
|
y2 = default_ctm[1] * x2 + default_ctm[3] * y2 + default_ctm[5];
|
||||||
|
|
||||||
|
// TODO: check overlap when x2-x1-width<0 or y2-y1-width<0
|
||||||
|
html_fout << "position:absolute;"
|
||||||
|
<< "left:" << _round(x1 - width/2) << "px;"
|
||||||
|
<< "bottom:" << _round(y1 - width/2) << "px;"
|
||||||
|
<< "width:" << _round(x2-x1-width) << "px;"
|
||||||
|
<< "height:" << _round(y2-y1-width) << "px;";
|
||||||
|
|
||||||
|
|
||||||
html_fout << "\"></div>";
|
html_fout << "\"></div>";
|
||||||
|
|
||||||
if(dest_str != "")
|
if(dest_str != "")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user