diff --git a/include/qpdf/QPDFJob.hh b/include/qpdf/QPDFJob.hh index cf65d10b..de0e585d 100644 --- a/include/qpdf/QPDFJob.hh +++ b/include/qpdf/QPDFJob.hh @@ -39,6 +39,7 @@ #include class QPDFWriter; +class Pipeline; class QPDFJob { @@ -509,7 +510,7 @@ class QPDFJob void writeOutfile(QPDF& pdf); // JSON - void doJSON(QPDF& pdf); + void doJSON(QPDF& pdf, Pipeline*); std::set getWantedJSONObjects(); void doJSONObjects(QPDF& pdf, JSON& j); void doJSONObjectinfo(QPDF& pdf, JSON& j); diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc index 63312f27..0b35a289 100644 --- a/libqpdf/QPDFJob.cc +++ b/libqpdf/QPDFJob.cc @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -1588,7 +1589,7 @@ QPDFJob::json_out_schema_v1() } void -QPDFJob::doJSON(QPDF& pdf) +QPDFJob::doJSON(QPDF& pdf, Pipeline* p) { JSON j = JSON::makeDictionary(); // This version is updated every time a non-backward-compatible @@ -1665,7 +1666,7 @@ ideally with the file that caused the error and the output below. Thanks!\n\ } } - *(this->m->cout) << j.unparse() << std::endl; + *p << j.unparse() << "\n"; } void @@ -1675,7 +1676,9 @@ QPDFJob::doInspection(QPDF& pdf) doCheck(pdf); } if (m->json_version) { - doJSON(pdf); + Pl_OStream os("stdout", *(this->m->cout)); + doJSON(pdf, &os); + os.finish(); } if (m->show_npages) { QTC::TC("qpdf", "QPDFJob npages");