{"id":19560075,"url":"https://github.com/plotdb/pageshot","last_synced_at":"2026-05-11T12:37:54.564Z","repository":{"id":40271096,"uuid":"240740467","full_name":"plotdb/pageshot","owner":"plotdb","description":"api + server for taking (multi-)website screenshot in png / pdf formats","archived":false,"fork":false,"pushed_at":"2023-03-04T06:03:26.000Z","size":1407,"stargazers_count":0,"open_issues_count":7,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-09-20T08:59:15.209Z","etag":null,"topics":["pdf","screenshot"],"latest_commit_sha":null,"homepage":"","language":"CSS","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/plotdb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-15T15:44:09.000Z","updated_at":"2021-04-13T10:21:26.000Z","dependencies_parsed_at":"2024-11-11T05:05:51.596Z","dependency_job_id":"edd40a3e-a858-4ec8-9b33-8ff754c766f8","html_url":"https://github.com/plotdb/pageshot","commit_stats":{"total_commits":21,"total_committers":1,"mean_commits":21.0,"dds":0.0,"last_synced_commit":"3e4c75f25308d99694ba702f461e3b43e2814a6c"},"previous_names":[],"tags_count":3,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotdb%2Fpageshot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotdb%2Fpageshot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotdb%2Fpageshot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotdb%2Fpageshot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plotdb","download_url":"https://codeload.github.com/plotdb/pageshot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240817124,"owners_count":19862430,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["pdf","screenshot"],"created_at":"2024-11-11T05:05:49.354Z","updated_at":"2026-05-11T12:37:49.519Z","avatar_url":"https://github.com/plotdb.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pageshot\n\nsimple express server and APIs powered by puppeteer for following purpose:\n\n - web page screenshot\n - web page to pdf\n - pdf merge\n\n\n## Security Note\n\nPuppeteer runs headless browser which can access content within intranet, and thus might be vulnerable to [SSRF](https://en.wikipedia.org/wiki/Server-side_request_forgery) exploit. To accept arbitrary user input, try running pageshot server in a container with proper network configuration.\n\n\n\n## Usage\n\ninstall:\n\n    npm install --save @plotdb/pageshot\n\n\nrun api server:\n\n    npx pageshot -p \u003cport\u003e\n\nthis will start a screenshot server listening to specific port.\n\n\nTo take a screenshot, send a POST request to `\u003cdomain\u003e/api/screenshot` with a payload in below format:\n\n    { url: \"url-to-screenshot\"}\n\nor\n\n    { html: \"code-to-render\" }\n\nFor example:\n\n    payload = {url: \"https://google.com\"}\n    ld$.fetch \"http://localhost:9010/api/\", {method: \\POST}, {json: payload}\n      .then -\u003e it.arrayBuffer!\n      .then -\u003e URL.createObjectURL(new Blob([new Uint8Array(it, 0, it.length)], {type: \"image/png\"}))\n      .then (url) -\u003e\n        img = new Image!\n        img.src = url\n\n\nThere are 3 api curently available:\n\n - POST `/api/screenshot` - taking screenshot in png format. \n - POST `/api/print` - taking screenshot in pdf format. input similar to `/api/screenshot`.\n - POST `/api/merge` - merge multiple document into one pdf. payload format:\n   - `list`: a list of documents to merge. Each is an object with following format:\n     - `html`: html code to print and merge.\n     - `url`: url for web page to print and merge. omitted when `html` is available\n     - `pdffile`: file path for pdf file to merge.\n     - `pdflink`: url for pdf file to merge.\n       - note: `pdffile` and `pdflink` only work in nodeJS API when calling with `trust-input` set to true. see `API`.\n\n## API\n\n`@plotdb/pageshot` also provides JS api for those http api counterpart. To use JS api, first init a `pageshot` page mananger:\n\n    require! \u003c[pageshot]\u003e\n    ss = new pageshot( opt )\n\noptions:\n\n * count - size of page pool. default 4, max 20.\n\n\nscreenshot object API:\n\n * init - initialize page manager. must be called before used.\n * shot(payload) - take a screenshot, return Buffer of the image in PNG format.\n * get - get a page handler. must free it after using. return an object as:\n   - busy - is this page occupied\n   - page - the page object. check puppeteer for more information. sample usage:\n     - page.setContent \"some html code\", {waitUntil, \"domcontentloaded\"}\n     - page.goto \"some-url\"\n * free(obj) - free this page.\n * print({url, html}): print specific document.\n * screenshot({url, html}): screenshot specific document.\n * merge(payload, trustInput): merge multiple document.\n   - `payload`: as described in previous section.\n   - `trustInput`: default false. when set to true, `pdffile` and `pdflink` options are enabled.\n\n\nSample usage:\n\n    lc = {}\n    ps = new pageshot!\n    ps.init!\n      # take a screenshot of google.com through ps.screenshot API\n      .then -\u003e ps.screenshot url: \"https://google.com\"\n      .then -\u003e fs.write-file-sync \"out.png\", it\n\n      # ... or, manually operate the page instance\n      .then -\u003e ps.get!\n      .then (obj) -\u003e\n        lc.obj = obj\n        # either one of following\n        # obj.page.setContent html, {waitUntil: \"domcontentloaded\"}\n        # obj.page.goto url\n      .then -\u003e lc.obj.page.screenshot!\n      .then -\u003e ps.free lc.obj\n\n\n## PDF Merge\n\nPDF merging is provided by `easy-pdf-merge`, which in turn depends on related `java` package. Java is needed for using this functionality, and can be installed via following commands:\n\n\n    wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -\n    sudo apt-get install software-properties-common\n    sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/\n    sudo apt-get update \u0026\u0026 sudo apt-get install adoptopenjdk-8-hotspot\n\n\n## Font\n\nWhen generating documents with CJK characters, you may want to install related fonts in your system:\n\n    sudo apt-get fonts-noto-cjk\n\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplotdb%2Fpageshot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplotdb%2Fpageshot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplotdb%2Fpageshot/lists"}