{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/pdf.js/issues/6705","repository_url":"https://api.github.com/repos/mozilla/pdf.js","labels_url":"https://api.github.com/repos/mozilla/pdf.js/issues/6705/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/pdf.js/issues/6705/comments","events_url":"https://api.github.com/repos/mozilla/pdf.js/issues/6705/events","html_url":"https://github.com/mozilla/pdf.js/issues/6705","id":119505677,"number":6705,"title":"Space inserted between each letter in textLayer","user":{"login":"Woodgnome","id":2242306,"avatar_url":"https://avatars3.githubusercontent.com/u/2242306?v=4","gravatar_id":"","url":"https://api.github.com/users/Woodgnome","html_url":"https://github.com/Woodgnome","followers_url":"https://api.github.com/users/Woodgnome/followers","following_url":"https://api.github.com/users/Woodgnome/following{/other_user}","gists_url":"https://api.github.com/users/Woodgnome/gists{/gist_id}","starred_url":"https://api.github.com/users/Woodgnome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Woodgnome/subscriptions","organizations_url":"https://api.github.com/users/Woodgnome/orgs","repos_url":"https://api.github.com/users/Woodgnome/repos","events_url":"https://api.github.com/users/Woodgnome/events{/privacy}","received_events_url":"https://api.github.com/users/Woodgnome/received_events","type":"User","site_admin":false},"labels":[{"id":211681,"url":"https://api.github.com/repos/mozilla/pdf.js/labels/4-text-selection","name":"4-text-selection","color":"DDDDDD","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2015-11-30T14:42:00Z","updated_at":"2017-11-28T13:51:47Z","closed_at":null,"author_association":"NONE","body":"PDF file:\nhttp://s000.tinyupload.com/index.php?file_id=87754221024253650553\n\nThe text layer is rendered with extra spaces between each letter, for example:\n\nCorrect text: \"VELKOMMEN TIL ALMINDINGEN\"\nRendered text: \"V E L K O M M E N   T I L   A L M I N D I N G E N\"\n"},"comment":{"url":"https://api.github.com/repos/mozilla/pdf.js/issues/comments/347529408","html_url":"https://github.com/mozilla/pdf.js/issues/6705#issuecomment-347529408","issue_url":"https://api.github.com/repos/mozilla/pdf.js/issues/6705","id":347529408,"user":{"login":"Hikariii","id":1484903,"avatar_url":"https://avatars0.githubusercontent.com/u/1484903?v=4","gravatar_id":"","url":"https://api.github.com/users/Hikariii","html_url":"https://github.com/Hikariii","followers_url":"https://api.github.com/users/Hikariii/followers","following_url":"https://api.github.com/users/Hikariii/following{/other_user}","gists_url":"https://api.github.com/users/Hikariii/gists{/gist_id}","starred_url":"https://api.github.com/users/Hikariii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hikariii/subscriptions","organizations_url":"https://api.github.com/users/Hikariii/orgs","repos_url":"https://api.github.com/users/Hikariii/repos","events_url":"https://api.github.com/users/Hikariii/events{/privacy}","received_events_url":"https://api.github.com/users/Hikariii/received_events","type":"User","site_admin":false},"created_at":"2017-11-28T13:51:47Z","updated_at":"2017-11-28T13:51:47Z","author_association":"NONE","body":"Same problem with this pdf:\r\n[text-spacing-error.pdf](https://github.com/mozilla/pdf.js/files/1510006/text-spacing-error.pdf)\r\n\r\nConfiguration:\r\n- Web browser and its version: node v8.6.0\r\n- Operating system and its version: ubuntu 16.04\r\n- PDF.js version: 2.0.104\r\n- Is a browser extension: no\r\n\r\nSteps to reproduce the problem:\r\n1. render the pdf with:\r\n```javascript\r\npage.getTextContent({\r\n\t\t\tnormalizeWhitespace: true,\r\n\t\t\tdisableCombineTextItems: true\r\n\t\t})\r\n```\r\n2. merge the resulting item strings `textContent.item[i].str`\r\n\r\nWhat is the expected behavior?\r\nThe starting text for the second page must be:\r\n`-  5  1 DE ORGANISATIE EN DE PROBLEEMSTELLING IN HAAR CONTEXT`\r\n\r\nWhat went wrong?\r\nThe starting text for the second page is:\r\n`-  5  1 D E ORGANISAT IE EN D E  P ROBL EEM STEL L ING IN  HAAR CONTEXT`\r\nSpaces are added within the word.\r\n\r\nThe code that gets adds the space WITHIN the word is:\r\nhttps://github.com/mozilla/pdf.js/blob/master/src/core/evaluator.js#L1656-L1658\r\nThe given width (advance) is a tiny bit bigger than textContentItem.fakeSpaceMin.\r\n\r\n@timvandermeij your statement about the advance being bigger than the `spaceWidth * SPACE_FACTOR` is correct.\r\nSolution here is to set SPACE_FACTOR to 0.4.\r\nThis renders the words perfectly.\r\n\r\nThis is an issue within the default pdf.js viewer."}}
{"actor":{"display_login":"Hikariii"}}