Commit 0ce48aad authored by Randall Leeds's avatar Randall Leeds

Match PDF.js behavior for skipping whitespace

parent 610c67d8
......@@ -26,13 +26,14 @@ getPageTextContent = (pageIndex, cache) ->
if cache[pageIndex]?
return Promise.resolve(cache[pageIndex])
else
return PDFViewerApplication.pdfViewer.getPageTextContent(pageIndex)
.then((textContent) -> (item.str for item in textContent.items).join(''))
.then((textContent) ->
joinItems = ({items}) ->
nonEmpty = (item.str for item in items when /\S/.test(item.str))
textContent = nonEmpty.join('')
cache[pageIndex] = textContent
return textContent
)
return PDFViewerApplication.pdfViewer.getPageTextContent(pageIndex)
.then(joinItems)
getPageOffset = (pageIndex, cache = {}) ->
index = -1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment