plessl / wkpdf

A command line HTML to PDF converter for Mac OS X
http://plessl.github.com/wkpdf
MIT License
184 stars 24 forks source link

Send output to standard output by default #16

Closed plessl closed 9 years ago

plessl commented 13 years ago

wkpdf should respect good Unix conventions and print its results to stdout if not otherwised specified via --output.

nilsm commented 12 years ago

That would be great. I would also very much welcome support for stdin input if --source isn't specified, so that it can be used locally without filenames/urls. [also emailed you before I found the issue here]

plessl commented 12 years ago

Reading from stdin using a NSUrl was prevented by a bug in previous versions of OS X.

I just tested what the current state of the affairs is in OS X 10.7.3 and it looks like the problem when reading from std is solved.

Could you please check, whether the following (or something similar) works for you too:

cat document.html | wkpdf --source /dev/stdin --output document.pdf

nilsm commented 12 years ago

Thanks - that command line works for me on 0.6.1 on OSX 10.6.8.

Also tried --output /dev/stdout - this fails with the error below, although I'm guessing it isn't expected to work

ruby[499:903] Printing failed because PMSessionBeginPageNoDialog() returned -30871

plessl commented 12 years ago

I'm glad to hear that --input /dev/stdin worked for you too. I will make --input an optional parameter and set the default file to /dev/stdin.

The --output /dev/stdout should actually work, but doesn't. I will need to investigate whether this is a problem with my implementation or a bug in Cocoa.

plessl commented 12 years ago

I have just released wkpdf 0.6.2 which reads from stdin by default. Writing to stdout still needs to be implemented.

However, it should be fairly easy to do (patches are welcome).

These links give some ideas how to do this:

plessl commented 9 years ago

I appreciate your interest in wkpdf.

Unfortunately I have to inform you that changes in OS X made it difficult for me to provide the installation and usage experience, which I envisioned for wkpdf. Hence, I have stopped the development of the rubygems version of wkpdf in December 2014.

More details on the reasons and some words on how you could contribute to a reincarnation of wkpdf can be found here:

http://plessl.github.io/wkpdf/

Cheers, Christian