{"id":45964277,"url":"https://github.com/flyingeek/scriptable-pdfjs","last_synced_at":"2026-02-28T14:02:17.424Z","repository":{"id":42906526,"uuid":"250857511","full_name":"flyingeek/scriptable-pdfjs","owner":"flyingeek","description":"A PDF to text converter for Scriptable App (iOS) working offline","archived":false,"fork":false,"pushed_at":"2023-01-06T02:44:09.000Z","size":1023,"stargazers_count":7,"open_issues_count":12,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-04-10T15:56:21.777Z","etag":null,"topics":["pdf2txt","pdftotext","scriptable-app"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flyingeek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-28T17:45:08.000Z","updated_at":"2022-11-25T22:03:41.000Z","dependencies_parsed_at":"2023-02-05T03:30:15.606Z","dependency_job_id":null,"html_url":"https://github.com/flyingeek/scriptable-pdfjs","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/flyingeek/scriptable-pdfjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flyingeek%2Fscriptable-pdfjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flyingeek%2Fscriptable-pdfjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flyingeek%2Fscriptable-pdfjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flyingeek%2Fscriptable-pdfjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flyingeek","download_url":"https://codeload.github.com/flyingeek/scriptable-pdfjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flyingeek%2Fscriptable-pdfjs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29936364,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T13:49:17.081Z","status":"ssl_error","status_checked_at":"2026-02-28T13:48:50.396Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pdf2txt","pdftotext","scriptable-app"],"created_at":"2026-02-28T14:01:29.886Z","updated_at":"2026-02-28T14:02:17.406Z","avatar_url":"https://github.com/flyingeek.png","language":"JavaScript","readme":"\n# scriptable-pdfjs\n\nA PDF text parser for [Scriptable App](https://scriptable.app) (iOS).\n\niOS shortcuts PDF conversion is not always the good tool.\nDue to the \"intelligent\" column recognition of PDFKit, text output\nis sometime in total disorder. I needed a parser which always output text in a \npredictable order, and this tool does that using the pdfjs text extraction.\n\n## Building\n\nFirst install dependencies:\n\n```sh\nnpm install\n```\n\nTo create a build:\n\n```sh\nnpm run build\n```\n\n## Running from Scriptable\n\nCopy the file `dist/scriptable-pdfjs.html` into Scriptable Document Folder.\n\n(or you may simply download the latest version from [here](https://github.com/flyingeek/scriptable-pdfjs/releases/latest/download/scriptable-pdfjs.html))\n\nand use the gist [scriptable-pdfjs-demo](https://gist.github.com/flyingeek/70f5e09887f17dbfcd11a4b620a68b28) to play.\n\n## Running from Shortcuts app\n\nIn this example we also expect to find scriptable-pdfjs.html` in Scriptable\ndocuments folder\n\n- Pass a PDF using the sharesheet or an Open File action\n- Save a copy of that file in the Shortcut Folder to allow the next bookmark creation action\n- Add a Scriptable/Create bookmark action\n- Add a Scriptable/Run Inline action containing :\n\n```javascript\nlet fm;\ntry {\n  fm = FileManager.iCloud();\n} catch(e) {\n  fm = FileManager.local();\n}\n// use the same bookmark name as in the action above\nconst filePath = fm.bookmarkedPath(\"ShortcutPDF\");\n\n// We execute pdfjs in a WebView\nconst wv = new WebView();\nconst htmlFileUrl = fm.joinPath(fm.documentsDirectory(), \"scriptable-pdfjs.html\");\nawait fm.downloadFileFromiCloud(htmlFileUrl);\nawait wv.loadFile(htmlFileUrl);\n\nlet javascript = 'pdfjs.getText(';\njavascript += '\"' + fm.read(filePath).toBase64String() + '\"';\n//javascript += ', (pageText) =\u003e pageText.includes(\"(Long copy #1)\")';\n//javascript += ', true';\njavascript += ');'\n\nlet result = \"\";\ntry {\n  result = await wv.evaluateJavaScript(javascript, true);\n} catch (e) {\n  result = \"\";\n}\nreturn result;\n```\nFor some reasons... (bug in shortcuts or scriptable ?) You cannot convert\nthe PDF to Base64 and pass it as an argument to the script. You have to use\nthe bookmark trick and make the base64 conversion in Scriptable.\n\nFor file larger than 2.5 Mo, you can not run this script inline and you \nhave to modify the script to get results by using the clipboard.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflyingeek%2Fscriptable-pdfjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflyingeek%2Fscriptable-pdfjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflyingeek%2Fscriptable-pdfjs/lists"}