provide a RESTful interface to imagemagick's density method
$ git clone https://github.com/chevalvert/change-dpi
$ cd change-dpi
$ yarn install
$ yarn start
> $ NODE_ENV=development node index.js
> Server is listenning on http://<ip>:<port>
$ node change-dpi
> Server is listenning on http://192.168.1.54:8888
daemon with pm2
$ pm2 start change-dpi --log-date-format 'YY-MM-DD HH:mm:ss'
$ pm2 save
$ pm2 startup
$ pm2 log change-dpi
> YY-MM-DD HH:mm:ss: Server is listenning on http://<ip>:<port>
A 200
HTTP status code with the following JSON document:
{
"version": "major.minor.patch"
}
$ curl -X GET http://localhost:8888/api/ping
> {"version":"1.0.0"}%
The api expects the request body to be a multipart/form-data
encoded form data.
The <format>
argument is optionnal.
A 201
HTTP status code with the resulting file attached to the response (see expressjs#res.download).
In case of an error, the api will return a 500
HTTP status code with the following JSON document:
{
"error": "error message"
}
<html>
<body>
<form
action='http://localhost:8888/api/dpi/300/pdf'
method='post'
encType="multipart/form-data">
<input type="file" name="inputFile" />
<input type='submit' value='convert' />
</form>
</body>
</html>
change-dpi
use a .env
file for configuration. See .env.example.