1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-03 08:38:39 +00:00
This commit is contained in:
Lu Wang 2012-09-19 02:13:26 +08:00
parent 6d694cd195
commit c55fee198e
5 changed files with 47 additions and 34 deletions

View File

@ -11,13 +11,16 @@
/* for Chrome & Safari */
-webkit-text-stroke-width:0.13px;
}
.b {
.p {
position:relative;
background-color:white;
margin: 13px auto;
overflow: hidden;
}
.p {
position:relative;
.b {
position:absolute;
top:0;
left:0;
background-color:white;
overflow:hidden;
display:block;

View File

@ -1,6 +1,6 @@
/* hide all pages */
(function(){
var s = '.p{display:none;}';
var s = '.b{display:none;}';
var n = document.createElement("style");
n.type = "text/css";
if (n.styleSheet) {

View File

@ -6,29 +6,28 @@
* modifiedy by Lu WANG
*/
$(function() {
var $pages = $(".p"),
$pageWrappers = $(".b"),
$main = $("#pdf-main"),
l = $pages.length;
var $pages = $(".p");
var $page_boxes= $(".b");
var $main = $("#pdf-main");
var l = $pages.length;
function isPageVisible(i, H) {
var $pw = $($pageWrappers[i]),
t = $pw.offset().top,
b = t + $pw.height() ;
var $p = $($pages[i]);
var t = $p.offset().top;
var b = t + $p.height();
return ( ! ( b < 0 || t >= H ) );
}
function setVisibilities(from, to, visible) {
for(var i = from; i <= to; ++i) {
var $p = $($pages[i]);
if(visible) $p.show(); else $p.hide();
var $pb = $($page_boxes[i]);
if(visible) $pb.show(); else $pb.hide();
}
}
// Selectively rendering of pages that are visible or will be visible
function selectiveRender() {
var first = 0, last = l - 1,
H = $main.height();
var first = 0, last = l - 1, H = $main.height();
// Find the first visible page
while(first < l && !isPageVisible(first, H))

View File

@ -163,9 +163,8 @@ void HTMLRenderer::startPage(int pageNum, GfxState *state)
assert((!line_opened) && "Open line in startPage detected!");
html_fout
<< "<a name=\"a" << pageNum << "\">"
<< "<div class=\"b\" style=\"width:" << pageWidth << "px;height:" << pageHeight << "px;\">"
<< "<div id=\"p" << pageNum << "\" class=\"p\" style=\"width:" << pageWidth << "px;height:" << pageHeight << "px;";
<< "<div id=\"p" << pageNum << "\" class=\"p\" style=\"width:" << pageWidth << "px;height:" << pageHeight << "px;\">"
<< "<div id=\"b" << pageNum << "\" class=\"b\" style=\"width:" << pageWidth << "px;height:" << pageHeight << "px;";
if(param->process_nontext)
{
@ -224,7 +223,7 @@ void HTMLRenderer::endPage() {
cur_doc->processLinks(this, pageNum);
// close page
html_fout << "</div></div></a>" << endl;
html_fout << "</div></div>" << endl;
}
/*
@ -264,7 +263,7 @@ void HTMLRenderer::processLink(AnnotLink * al)
delete dest;
if(pageno > 0)
dest_str = (char*)str_fmt("#a%x", pageno);
dest_str = (char*)str_fmt("#p%x", pageno);
}
}
break;
@ -372,6 +371,7 @@ void HTMLRenderer::processLink(AnnotLink * al)
<< "width:" << _round(x2-x1-width) << "px;"
<< "height:" << _round(y2-y1-width) << "px;";
html_fout << "background-color:rgb(0,0,0,0);";
html_fout << "\"></div>";

View File

@ -216,22 +216,33 @@ void ffw_close(void)
void ffw_metric(int * ascent, int * descent)
{
*ascent = cur_fv->sf->ascent;
*descent = cur_fv->sf->descent;
DBounds bb;
SplineFont * sf = cur_fv->sf;
SplineFontFindBounds(sf, &bb);
struct pfminfo * info = &sf->pfminfo;
cur_fv->sf->pfminfo.os2_winascent = 0;
cur_fv->sf->pfminfo.os2_typoascent = 0;
cur_fv->sf->pfminfo.hhead_ascent = 0;
cur_fv->sf->pfminfo.winascent_add = 0;
cur_fv->sf->pfminfo.typoascent_add = 0;
cur_fv->sf->pfminfo.hheadascent_add = 0;
//debug
printf("%d %d\n", *ascent, *descent);
cur_fv->sf->pfminfo.os2_windescent = 0;
cur_fv->sf->pfminfo.os2_typodescent = 0;
cur_fv->sf->pfminfo.hhead_descent = 0;
cur_fv->sf->pfminfo.windescent_add = 0;
cur_fv->sf->pfminfo.typodescent_add = 0;
cur_fv->sf->pfminfo.hheaddescent_add = 0;
*ascent = sf->ascent;
*descent = sf->descent;
//debug
printf("%d %d\n", *ascent, *descent);
info->os2_winascent = 0;
info->os2_typoascent = 0;
info->hhead_ascent = 0;
info->winascent_add = 0;
info->typoascent_add = 0;
info->hheadascent_add = 0;
info->os2_windescent = 0;
info->os2_typodescent = 0;
info->hhead_descent = 0;
info->windescent_add = 0;
info->typodescent_add = 0;
info->hheaddescent_add = 0;
}
int ffw_get_em_size(void)