1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 07:08:08 +02:00

merge upstream

This commit is contained in:
Artur Adib 2012-09-18 16:57:09 -04:00
commit 863dd0d214
15 changed files with 409 additions and 306 deletions

View file

@ -8,7 +8,8 @@
<style type="text/css">
body {
margin-top: 1.0em;
background-color: #482a30;
background-color: rgb(64, 64, 64);
background-image: url(web/images/texture.png);
font-family: Helvetica, Arial, FreeSans, san-serif;
color: #ffffff;
}
@ -50,20 +51,28 @@
</div>
<h2>Try it out!</h2>
<p>Live <a href="web/viewer.html">demo</a> lives here.</p>
<p>Live <a href="web/viewer.html">demo</a> or firefox <a href="https://addons.mozilla.org/en-US/firefox/addon/pdfjs/">extension</a>.</p>
<h2>Authors</h2>
<p>Vivien Nicolas (21@vingtetun.org)
<br/>Andreas Gal (andreas.gal@gmail.com)
<br/>Soumya Deb (debloper@gmail.com)
<br/>Chris Jones (jones.chris.g@gmail.com)
<br/>Justin D'Arcangelo (justindarc@gmail.com)
<br/>sbarman (sbarman@eecs.berkeley.edu)
<br/>
<br/> </p>
<h2>Contact</h2>
<p> (andreas.gal@gmail.com)
<br/> </p>
Andreas Gal (gal@mozilla.com)<br/>
Chris G Jones (cjones@mozilla.com)<br/>
Shaon Barman (shaon.barman@gmail.com)<br/>
Vivien Nicolas (21@vingtetun.org)<br/>
Justin D'Arcangelo (justindarc@gmail.com)<br/>
Yury Delendik (ydelendik@mozilla.com)<br/>
Kalervo Kujala<br/>
Adil Allawi (@ironymark)<br/>
Jakob Miland (saebekassebil@gmail.com)<br/>
Artur Adib (aadib@mozilla.com)<br/>
Brendan Dahl (bdahl@mozilla.com)<br/>
David Quintana (gigaherz@gmail.com)<br/>
Julian Viereck<br/>
<a href="https://github.com/mozilla/pdf.js/graphs/contributors">...</a>
</p>
<h2>Contact</h2>
<p> (dev-pdf-js@lists.mozilla.org)
<br/> </p>
<h2>Download</h2>

View file

@ -1843,22 +1843,18 @@ var TextLayerBuilder = function textLayerBuilder(textLayerDiv) {
while (textDivs.length > 0) {
var textDiv = textDivs.shift();
if (textDiv.dataset.textLength > 0) {
textLayerFrag.appendChild(textDiv);
textLayerFrag.appendChild(textDiv);
if (textDiv.dataset.textLength > 1) { // avoid div by zero
// Adjust div width to match canvas text
ctx.font = textDiv.style.fontSize + ' ' + textDiv.style.fontFamily;
var width = ctx.measureText(textDiv.textContent).width;
ctx.font = textDiv.style.fontSize + ' sans-serif';
var width = ctx.measureText(textDiv.textContent).width;
if (width > 0) {
var textScale = textDiv.dataset.canvasWidth / width;
var textScale = textDiv.dataset.canvasWidth / width;
CustomStyle.setProp('transform' , textDiv,
'scale(' + textScale + ', 1)');
CustomStyle.setProp('transformOrigin' , textDiv, '0% 0%');
}
} // textLength > 0
CustomStyle.setProp('transform' , textDiv,
'scale(' + textScale + ', 1)');
CustomStyle.setProp('transformOrigin' , textDiv, '0% 0%');
}
}
textLayerDiv.appendChild(textLayerFrag);
@ -1889,14 +1885,13 @@ var TextLayerBuilder = function textLayerBuilder(textLayerDiv) {
// vScale and hScale already contain the scaling to pixel units
var fontHeight = fontSize * text.geom.vScale;
textDiv.dataset.canvasWidth = text.canvasWidth * text.geom.hScale;
textDiv.dataset.fontName = fontName;
textDiv.style.fontSize = fontHeight + 'px';
textDiv.style.fontFamily = fontName;
textDiv.style.left = text.geom.x + 'px';
textDiv.style.top = (text.geom.y - fontHeight) + 'px';
textDiv.textContent = PDFJS.bidi(text, -1);
textDiv.dir = text.direction;
textDiv.dataset.textLength = text.length;
this.textDivs.push(textDiv);
};
};
@ -2065,7 +2060,7 @@ document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) {
});
document.getElementById('searchTermsInput').addEventListener('keydown',
function() {
function(event) {
if (event.keyCode == 13) {
PDFView.search();
}
@ -2292,6 +2287,7 @@ window.addEventListener('keydown', function keydown(evt) {
PDFView.zoomIn();
handled = true;
break;
case 173: // FF/Mac '-'
case 109: // FF '-'
case 189: // Chrome '-'
PDFView.zoomOut();