spajak / cef-pdf

cef-pdf HTML to PDF utility
MIT License
79 stars 32 forks source link

[feature request] accept file from standard input #7

Closed ghost closed 7 years ago

ghost commented 7 years ago

I am running cef-pdf from within a Linux container and would like executions to pipe file input into the container. This would enable a common pattern of running containers and destroying them afterwards so I could run omething like:

$ cat some-file.html | docker run --rm -it --env DISPLAY=172.17.0.2:99 \
     my-cef-image cef-pdf \
    --backgrounds

I see this as an alternative to --file and --server options. That way I can run cef-pdf without having to save the input to disk or retrieve it from a URL.

spajak commented 7 years ago

That feature is partialy implemented but not activated. I'm not sure how to tell the program to output to stdout instead of a file and read from stdin. Simply omitting --file/--url and/or --output? Or use some special arguments like -?

ghost commented 7 years ago

Ah, neat! I have used wkhtmltopdf which uses the - flags to indicate piping. I could also see a --stream or --stdio flag. Personally I like the command line switches because I think they document themselves when appropriately named. Next week I will look up some example projects and can post other switch names here.

spajak commented 7 years ago

Feature implemented in acc42e2b64f891187bfe6654f16c7cf819235138

I would be very glad if you could test it.

ghost commented 7 years ago

wow, thanks again for working with me on these and turning them around so quickly @spajak ! I will be testing this today and will let you know.

ghost commented 7 years ago

Tested and verified that this is working as expected and I can pipe in and out of a container executing the command. Thank you for adding this.