1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-05 01:28:39 +00:00

more types or links

This commit is contained in:
Lu Wang 2012-09-26 16:00:55 +08:00
parent c47bcd9c64
commit 9990046263
2 changed files with 48 additions and 14 deletions

8
TODO
View File

@ -2,18 +2,16 @@ merge sub/sup into one line
bug found in baidu(ubuntu...) bug found in baidu(ubuntu...)
precise link dest precise link dest: more types
more types
cancel margins
try harder finding glyph names (using fontforge) for CID Type 0 try harder finding glyph names (using fontforge) for CID Type 0
rename single-html -> embed-font/image/css ... rename single-html -> embed-font/image/css ...
argument auto-completion create a glyph for ' ', if there is not in a font
add fallback font for ' ', or create glyph for it
==Future== ==Future==
argument auto-completion
use absolute positioning for long whitespace use absolute positioning for long whitespace
color invert color invert
detect duplicate base fonts when embedding detect duplicate base fonts when embedding

View File

@ -245,25 +245,61 @@ var pdf2htmlEX = (function(){
if(detail_str == undefined) return; if(detail_str == undefined) return;
var ok = false; var ok = false;
var detail= JSON.parse(detail_str); var detail = JSON.parse(detail_str);
var target_page = _.pages[detail[0]];
if(target_page == undefined) return;
var pos = [0,0];
var upside_down = true;
// TODO: zoom
// TODO: BBox
switch(detail[1]) { switch(detail[1]) {
case 'XYZ': case 'XYZ':
var pos = [(detail[2] == null) ? cur_pos[0] : detail[2] pos = [(detail[2] == null) ? cur_pos[0] : detail[2]
,(detail[3] == null) ? cur_pos[1] : detail[3]]; ,(detail[3] == null) ? cur_pos[1] : detail[3]];
pos = transform(cur_page.ctm, pos); ok = true;
break;
_.scroll_to(detail[0], pos); case 'Fit':
case 'FitB':
pos = [0,0];
ok = true;
break;
case 'FitH':
case 'FitBH':
pos = [0, (detail[2] == null) ? cur_pos[1] : detail[2]]
ok = true;
break;
case 'FitV':
case 'FitBV':
pos = [(detail[2] == null) ? cur_pos[0] : detail[2], 0];
ok = true;
break;
case 'FitR':
/* locate the top-left corner of the rectangle */
pos = [detail[2], detail[5]];
upside_down = false;
ok = true;
break;
pos = [0,0];
ok = true; ok = true;
break; break;
default: default:
ok = false;
break; break;
} }
if(ok) if(ok) {
pos = transform(target_page.ctm, pos);
if(upside_down) {
pos[1] = target_page.height() - pos[1];
}
_.scroll_to(detail[0], pos);
e.preventDefault(); e.preventDefault();
}
}, },
/* pos=[x,y], where (0,0) is the top-left corner */
scroll_to : function(pageno, pos) { scroll_to : function(pageno, pos) {
var target_page = this.pages[pageno]; var target_page = this.pages[pageno];
if(target_page == undefined) return; if(target_page == undefined) return;
@ -271,7 +307,7 @@ var pdf2htmlEX = (function(){
var cur_target_pos = target_page.position(); var cur_target_pos = target_page.position();
this.container.scrollLeft(this.container.scrollLeft()-cur_target_pos[0]+pos[0]); this.container.scrollLeft(this.container.scrollLeft()-cur_target_pos[0]+pos[0]);
this.container.scrollTop(this.container.scrollTop()-cur_target_pos[1]+target_page.height()-pos[1]); this.container.scrollTop(this.container.scrollTop()-cur_target_pos[1]+pos[1]);
}, },
__last_member__ : 'no comma' /*,*/ __last_member__ : 'no comma' /*,*/