Page to what? Convert web pages to PDF or images
126
P2W is a web page converted to PDF or image tool, provides command and http api
If you're not using Docker, you'll need to have Chrome installed before you can use it.
First you need to download the P2W executable file according to your operating system.
If you are using Linux, place the executable in the /usr/local/bin directory.
If you are using Windows, place the executable in any directory in the PATH environment variable.
docker run -d -p 12800:12800 --name p2w skyezhang/p2w
P2W provides pdf and image commands.
. /)image Dedicated Flags
Note that
pathandsendcan only be used interchangeably, with thesendtag taking precedence.
# Export PDF to current path
p2w pdf -u="https://github.com" -p="./"
# Send PDF to specified address
p2w pdf -u="https://github.com" -c="github" -s="http://localhost:8080/test"
# Output full page image to current path
p2w image -u="https://github.com" -p="./" -q="90"
# Send the full page image to the specified address
p2w image -u="https://github.com" -q="90" -c="github" -s="http://localhost:8080/test"
# Outputs an image of the specified element to the current path
p2w image -u="https://github.com" -p="./" -q="90" -e=".application-main"
# Sends an image of a specified element to a specified address
p2w image -u="https://github.com" -q="90" -e=".application-main" -c="github" -s="http://localhost:8080/test"
P2W provides two GET interfaces, /api/pdf and /api/img.
image special parameters
Please note that you need to start the HTTP server with the command line command server to access it.
p2w server -p="12800"
go mod download
go mod tidy
# Packaging for the current platform
go build -o p2w -ldflags '-s -w'
# MacOS
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o p2w -ldflags '-s -w'
# Linux
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o p2w -ldflags '-s -w'
# Windows
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o p2w -ldflags '-s -w'
# Compile the Linux version first
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o p2w -ldflags '-s -w'
# Then build the image in the directory
docker build -t skyezhang/p2w:1.0.0 .
Content type
Image
Digest
sha256:7fce6fca8…
Size
196.9 MB
Last updated
over 2 years ago
docker pull skyezhang/p2w:1.0.1