From b9b3d5477e62af42f917a172fab829f7060a6800 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Thu, 30 Jan 2020 10:42:24 +0000 Subject: [PATCH] First little JSON output working --- cpdfcommand.ml | 4 ++-- cpdfwriteJSON.ml | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 358113f..e03d455 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -1,9 +1,9 @@ (* cpdf command line tools *) let demo = false -let noncomp = true +let noncomp = false let major_version = 2 let minor_version = 4 -let version_date = "(devel, 24th January 2020)" +let version_date = "(devel, 30th January 2020)" open Pdfutil open Pdfio diff --git a/cpdfwriteJSON.ml b/cpdfwriteJSON.ml index b23a6a5..322cbd6 100644 --- a/cpdfwriteJSON.ml +++ b/cpdfwriteJSON.ml @@ -1 +1,12 @@ -let write fh parse_content pdf = () +module J = Tjjson + +let test = J.Array [J.Number "100"; J.String "foo"] + +let write fh parse_content pdf = + let b = Buffer.create 256 in + let formatter = Format.formatter_of_buffer b in + Tjjson.format formatter test; + Format.pp_print_flush formatter (); + output_string fh (Buffer.contents b) + +