jeertmans / rpdf

PDF command-line utils written in Rust
MIT License
34 stars 2 forks source link

[FEATURE] Dump results into a JSON #81

Open jeertmans opened 1 week ago

jeertmans commented 1 week ago

Issue

Currently, results are printed out to the terminal, in a relatively nice looking table.

However, this means information could be very hard to extract if one, e.g., wanted to use rpdf and pipe it's output to another tool.

I think a more structured output format could be very useful.

Suggested fix

I suggest we offer JSON output format, that will output the information to a terminal (or file?) in a structured way.

To do so, each command should return a structure, that contains relevant statistics about the PDFs processed. Then, the structure will either derive JSON and be printed as a raw JSON, or transformed into a nice table (as this is already the case). Some option like pretty formatting and write to file could be also added to that JSON output.

If you are interested to help, please feel free to submit a PR or ask any question :-)