From 83be2191b4f3eb8906160d61f61cae48532ee651 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 18 Jun 2022 09:40:41 -0400 Subject: Use "save" logger when saving data to standard output This includes the output PDF, streams from --show-object and attachments from --save-attachment. This also enables --verbose and --progress to work with saving to stdout. --- libqpdf/QPDFLogger.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libqpdf/QPDFLogger.cc') diff --git a/libqpdf/QPDFLogger.cc b/libqpdf/QPDFLogger.cc index 859d6dcd..3b25c050 100644 --- a/libqpdf/QPDFLogger.cc +++ b/libqpdf/QPDFLogger.cc @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -182,6 +183,9 @@ QPDFLogger::setError(std::shared_ptr p) void QPDFLogger::setSave(std::shared_ptr p) { + if (this->m->p_save == p) { + return; + } if (p == this->m->p_stdout) { auto pt = dynamic_cast(p.get()); if (pt->getUsed()) { @@ -192,6 +196,7 @@ QPDFLogger::setSave(std::shared_ptr p) if (this->m->p_info == this->m->p_stdout) { this->m->p_info = this->m->p_stderr; } + QUtil::binary_stdout(); } this->m->p_save = p; } -- cgit v1.2.3-54-g00ecf