Skip to content

Latest commit

 

History

History
74 lines (50 loc) · 2.44 KB

README.md

File metadata and controls

74 lines (50 loc) · 2.44 KB

webkit2png-daemon

License GitHub issues GitHub commit activity

A server daemon written in Perl which listens in an specified TCP port for a string containing the URL to be screenshoted. It uses the WebKit2PNG script to make the screenshot.

You can configure the listening port, host and other parameters for the daemon using the Net::Server configuration. See the run.sh script for an example on how to run the daemon.

Usage

Adjust the paths of the programs here:

my $PYTHON = '/usr/bin/python';
my $XVFB = '/usr/bin/xvfb-run';
my $WEBKIT2PNG = 'webkit2png.py';
my $CAT = '/bin/cat';

Create the directory for the logs and set the correct permissions/ownerships:

mkdir /var/log/webkit2png/
chown $USER:$GROUP /var/log/webkit2png/

Start the server executing:

perl WebKit2PNGDaemon.pl

Then send a string (the URL to be screenshoted) to the specified port and host. The server will execute WebKit2PNG and return a first line containing

LENGTH: <length of the captured image in bytes>

and then the bytes of the captured screen in PNG format, or an error image.

Dependencies

Perl modules

You can install them using perl -MCPAN -e shell or your distro's package manager:

Programs

Notes

  • You must download the webkit2png Python script.
  • If you are into cloud FaaS, look here.

License

Copyright (c) 2023, Rodolfo González González.

Read the LICENSE file.