{"id":18725702,"url":"https://github.com/skye-z/p2w","last_synced_at":"2025-11-11T19:30:14.573Z","repository":{"id":180894580,"uuid":"665520814","full_name":"skye-z/p2w","owner":"skye-z","description":"Page to what? Convert web pages to PDF or images","archived":false,"fork":false,"pushed_at":"2024-02-28T04:33:17.000Z","size":98,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-28T13:18:44.847Z","etag":null,"topics":["convert","go","image","integrated","lightweight","page-to-image","page-to-pdf","pdf"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skye-z.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-07-12T11:42:16.000Z","updated_at":"2024-03-01T02:29:29.000Z","dependencies_parsed_at":"2024-02-28T05:42:35.928Z","dependency_job_id":null,"html_url":"https://github.com/skye-z/p2w","commit_stats":null,"previous_names":["skye-z/p2w"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skye-z%2Fp2w","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skye-z%2Fp2w/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skye-z%2Fp2w/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skye-z%2Fp2w/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skye-z","download_url":"https://codeload.github.com/skye-z/p2w/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239592978,"owners_count":19664855,"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":["convert","go","image","integrated","lightweight","page-to-image","page-to-pdf","pdf"],"created_at":"2024-11-07T14:11:26.425Z","updated_at":"2025-11-11T19:30:14.504Z","avatar_url":"https://github.com/skye-z.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# P2W - Page To What\n\n[中文](README_zh.md)\n\nP2W is a web page converted to PDF or image tool, provides command and http api\n\n[![](https://img.shields.io/badge/Go-1.20+-%2300ADD8?style=flat\u0026logo=go)](go.work)\n[![](https://img.shields.io/badge/P2W-1.0.0-green)](control)\n[![CodeQL](https://github.com/skye-z/p2w/workflows/CodeQL/badge.svg)](https://github.com/skye-z/p2w/security/code-scanning)\n\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=skye-z_p2w\u0026metric=security_rating)](https://sonarcloud.io/summary/new_code?id=skye-z_p2w)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=skye-z_p2w\u0026metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=skye-z_p2w)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=skye-z_p2w\u0026metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=skye-z_p2w)\n[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=skye-z_p2w\u0026metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=skye-z_p2w)\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=skye-z_p2w\u0026metric=bugs)](https://sonarcloud.io/summary/new_code?id=skye-z_p2w)\n\n## TODO\n\n* [x] Command\n    * [x] PDF\n    * [x] Image\n    * [x] Server\n* [x] API\n    * [x] PDF\n    * [x] Image\n\n## Install\n\nIf you're not using Docker, you'll need to have *Chrome* installed before you can use it.\n\n### Executable File\n\nFirst you need to download the P2W executable file according to your operating system.\n\nIf you are using Linux, place the executable in the `/usr/local/bin` directory.\n\nIf you are using Windows, place the executable in any directory in the `PATH` environment variable.\n\n### Docker\n\n```shell\ndocker run -d -p 12800:12800 --name p2w ghcr.io/skye-z/p2w:latest\n```\n\n## Use\n\n### Use from the command line\n\nP2W provides `pdf` and `image` commands.\n\n* Public Flags\n    * --url/-u: URL to be converted.\n    * --path/-p: output path after conversion (default `. /`)\n    * --code/-c: the code that identifies the conversion task\n    * ---send/-s: the address to send the converted file to.\n* `image` Dedicated Flags\n    * --element/-e: intercept element\n    * --quality/-q: image quality (default 90)\n\n\u003e Note that `path` and `send` can only be used interchangeably, with the `send` tag taking precedence.\n\n```shell\n# Export PDF to current path\np2w pdf -u=\"https://github.com\" -p=\"./\"\n# Send PDF to specified address\np2w pdf -u=\"https://github.com\" -c=\"github\" -s=\"http://localhost:8080/test\"\n\n# Output full page image to current path\np2w image -u=\"https://github.com\" -p=\"./\" -q=\"90\"\n# Send the full page image to the specified address\np2w image -u=\"https://github.com\" -q=\"90\" -c=\"github\" -s=\"http://localhost:8080/test\"\n\n# Outputs an image of the specified element to the current path\np2w image -u=\"https://github.com\" -p=\"./\" -q=\"90\" -e=\".application-main\"\n# Sends an image of a specified element to a specified address\np2w image -u=\"https://github.com\" -q=\"90\" -e=\".application-main\" -c=\"github\" -s=\"http://localhost:8080/test\"\n```\n\n### Used through the HTTP interface\n\nP2W provides two `GET` interfaces, `/api/pdf` and `/api/img`.\n\n* public parameters\n    * url: the url to be converted\n    * code: the code of the conversion task\n    * send: the address to send the converted file to\n* `image` special parameters\n    * element: the element to be captured\n    * quality: quality of the image (default 90)\n\nPlease note that you need to start the HTTP server with the command line command `server` to access it.\n\n``` shell\np2w server -p=\"12800\"\n```\n\n## Packaging and compilation\n\n### Compile the executable\n\n```shell\ngo mod download\ngo mod tidy\n# Packaging for the current platform\ngo build -o p2w -ldflags '-s -w'\n\n# MacOS\nCGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o p2w -ldflags '-s -w'\n# Linux\nCGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o p2w -ldflags '-s -w'\n# Windows\nCGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o p2w -ldflags '-s -w'\n```\n\n### Packaging Docker images\n\n```shell\n# Compile the Linux version first\nCGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o p2w -ldflags '-s -w'\n# Then build the image in the directory\ndocker build -t skye-z/p2w:1.0.0 .\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskye-z%2Fp2w","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskye-z%2Fp2w","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskye-z%2Fp2w/lists"}