From e90226c1d8d2746cfeb10af2cea540101c00dcea Mon Sep 17 00:00:00 2001 From: Johannes Zillmann Date: Fri, 3 Feb 2017 19:14:12 +0100 Subject: [PATCH] =?UTF-8?q?don=E2=80=99t=20divide=20by=20fontHeight=20if?= =?UTF-8?q?=20result=20is=20<=200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/javascript/components/LoadingView.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/javascript/components/LoadingView.jsx b/src/javascript/components/LoadingView.jsx index ac655da..89aad83 100644 --- a/src/javascript/components/LoadingView.jsx +++ b/src/javascript/components/LoadingView.jsx @@ -57,17 +57,18 @@ export default class LoadingView extends React.Component { var viewport = page.getViewport(scale); page.getTextContent().then(function(textContent) { const textItems = textContent.items.map(function(item) { - var tx = PDFJS.Util.transform( // eslint-disable-line no-undef + const tx = PDFJS.Util.transform( // eslint-disable-line no-undef viewport.transform, item.transform ); - var fontHeight = Math.sqrt((tx[2] * tx[2]) + (tx[3] * tx[3])); + const fontHeight = Math.sqrt((tx[2] * tx[2]) + (tx[3] * tx[3])); + const dividedHeight = item.height / fontHeight; return new TextItem({ x: item.transform[4], y: item.transform[5], width: item.width, - height: item.height / fontHeight, + height: dividedHeight <= 1 ? item.height : dividedHeight, text: item.str }); });