{"action":"created","issue":{"url":"https://api.github.com/repos/tmbdev/hocr-tools/issues/69","repository_url":"https://api.github.com/repos/tmbdev/hocr-tools","labels_url":"https://api.github.com/repos/tmbdev/hocr-tools/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/tmbdev/hocr-tools/issues/69/comments","events_url":"https://api.github.com/repos/tmbdev/hocr-tools/issues/69/events","html_url":"https://github.com/tmbdev/hocr-tools/issues/69","id":177990888,"number":69,"title":"hocr-pdf output failed","user":{"login":"dinosauria123","id":3067670,"avatar_url":"https://avatars.githubusercontent.com/u/3067670?v=3","gravatar_id":"","url":"https://api.github.com/users/dinosauria123","html_url":"https://github.com/dinosauria123","followers_url":"https://api.github.com/users/dinosauria123/followers","following_url":"https://api.github.com/users/dinosauria123/following{/other_user}","gists_url":"https://api.github.com/users/dinosauria123/gists{/gist_id}","starred_url":"https://api.github.com/users/dinosauria123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dinosauria123/subscriptions","organizations_url":"https://api.github.com/users/dinosauria123/orgs","repos_url":"https://api.github.com/users/dinosauria123/repos","events_url":"https://api.github.com/users/dinosauria123/events{/privacy}","received_events_url":"https://api.github.com/users/dinosauria123/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-09-20T07:56:47Z","updated_at":"2016-09-20T13:51:46Z","closed_at":null,"body":"Thank you for update of hocr-pdf.\r\n\r\nI try to convert image to searchable pdf by using hocr-pdf and my gcv2hocr.\r\nhocr-pdf sometimes fails to convert pdf.\r\n\r\nAttached scan0002.jpg and scan0002.hocr can convert to pdf.\r\n\r\nBut attached scan0003.jpg and scan0003.hocr fails to convert to pdf. \r\nThe error messages are below.\r\n\r\n> Traceback (most recent call last):\r\n  File \"hocr-pdf\", line 139, in <module>\r\n    export_pdf(sys.argv[1], 300)\r\n  File \"hocr-pdf\", line 64, in export_pdf\r\n    add_text_layer(pdf, image, height, dpi)\r\n  File \"hocr-pdf\", line 73, in add_text_layer\r\n    hocr = etree.parse(hocrfile, html.XHTMLParser())\r\n  File \"src/lxml/lxml.etree.pyx\", line 3427, in lxml.etree.parse (src/lxml/lxml.etree.c:85131)\r\n  File \"src/lxml/parser.pxi\", line 1782, in lxml.etree._parseDocument (src/lxml/lxml.etree.c:124005)\r\n  File \"src/lxml/parser.pxi\", line 1808, in lxml.etree._parseDocumentFromURL (src/lxml/lxml.etree.c:124374)\r\n  File \"src/lxml/parser.pxi\", line 1712, in lxml.etree._parseDocFromFile (src/lxml/lxml.etree.c:123169)\r\n  File \"src/lxml/parser.pxi\", line 1115, in lxml.etree._BaseParser._parseDocFromFile (src/lxml/lxml.etree.c:117533)\r\n  File \"src/lxml/parser.pxi\", line 573, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:110510\r\n)\r\n  File \"src/lxml/parser.pxi\", line 683, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:112276)\r\n  File \"src/lxml/parser.pxi\", line 613, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:111124)\r\nlxml.etree.XMLSyntaxError: xmlParseEntityRef: no name, line 469, column 234\r\n>\r\n\r\nI can not distinguish the problem comes from hocr-pdf or my gcv2hocr.\r\nIf you find problems in my gcv2hocr, please notify me.\r\n\r\n[scan0002.hocr.txt](https://github.com/tmbdev/hocr-tools/files/481893/scan0002.hocr.txt)\r\n[scan0002.jpg](https://cloud.githubusercontent.com/assets/3067670/18661903/db923192-7f52-11e6-8eb7-49dbf4fd9897.jpg)\r\n[scan0003.jpg](https://cloud.githubusercontent.com/assets/3067670/18661902/db8e888a-7f52-11e6-8de7-45b82b21528a.jpg)\r\n[scan0003.hocr.txt](https://github.com/tmbdev/hocr-tools/files/481892/scan0003.hocr.txt)\r\n\r\n\r\n\r\n  "},"comment":{"url":"https://api.github.com/repos/tmbdev/hocr-tools/issues/comments/248307125","html_url":"https://github.com/tmbdev/hocr-tools/issues/69#issuecomment-248307125","issue_url":"https://api.github.com/repos/tmbdev/hocr-tools/issues/69","id":248307125,"user":{"login":"dinosauria123","id":3067670,"avatar_url":"https://avatars.githubusercontent.com/u/3067670?v=3","gravatar_id":"","url":"https://api.github.com/users/dinosauria123","html_url":"https://github.com/dinosauria123","followers_url":"https://api.github.com/users/dinosauria123/followers","following_url":"https://api.github.com/users/dinosauria123/following{/other_user}","gists_url":"https://api.github.com/users/dinosauria123/gists{/gist_id}","starred_url":"https://api.github.com/users/dinosauria123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dinosauria123/subscriptions","organizations_url":"https://api.github.com/users/dinosauria123/orgs","repos_url":"https://api.github.com/users/dinosauria123/repos","events_url":"https://api.github.com/users/dinosauria123/events{/privacy}","received_events_url":"https://api.github.com/users/dinosauria123/received_events","type":"User","site_admin":false},"created_at":"2016-09-20T13:51:46Z","updated_at":"2016-09-20T13:51:46Z","body":"I have committed out to fix xml escape characters problem my gcv2hocr at GitHub.\r\n\r\nNow, hocr-pdf works fine and I can make searchable pdf file from 70 jpeg images from old Japanese camera book.\r\n\r\nI made a simple shell script to extract text from image by Google Cloud Vision OCR and make searchable pdf from them.\r\n\r\n>#!/bin/sh\r\na=1\r\nwhile [ $a -le 100 ]\r\ndo\r\n    sh ./gcvocr.sh scan00$a.jpg \"Your API Code\"\r\n    echo \"Google OCR scan00$a.jpg\"\r\n    ./a.out scan00$a.jpg.json scan00$a.hocr\r\n    echo \"convert scan00$a.hocr\"\r\n    a=`expr $a + 1`\r\ndone\r\npython hocr-pdf . > output.pdf\r\n\r\nIf you are interested in my output pdf, download it here (about 40MB)\r\nhttps://t.co/BUjCMgVnyr\r\n\r\nIt was written in 1928, public domein in Japan."}}
{"actor":{"display_login":"dinosauria123"}}