From a9acdb22cc898076bf6c5d9d20474274ed123458 Mon Sep 17 00:00:00 2001 From: szlt5 <117269245+szlt5@users.noreply.github.com> Date: Thu, 23 Jul 2026 12:40:12 +0800 Subject: [PATCH] Fix printing error: pdfio output "Missing Root object." --- cupsfilters/pdf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cupsfilters/pdf.c b/cupsfilters/pdf.c index 1f714b203..3e4386091 100644 --- a/cupsfilters/pdf.c +++ b/cupsfilters/pdf.c @@ -165,6 +165,11 @@ cfPDFPagesFP(FILE *file) // I - File pointer of PDF fwrite(buffer, 1, bytes_read, temp_fp); } + // call fflush(temp_fp) to flush the stdio buffer; + // otherwise pdfioFileOpen() may not see the complete contents of temp_filename because + // some data may still be buffered and not yet written to the file. + fflush(temp_fp); + // Open the temp file with pdfio pdfio_file_t *pdf = pdfioFileOpen(temp_filename, NULL, NULL, NULL, NULL);