From 710fa82fb087ce77e5b6bed7a1fb91ea834a268d Mon Sep 17 00:00:00 2001 From: zdenop Date: Sun, 27 Oct 2019 14:15:12 +0100 Subject: [PATCH] fix inverting (Bilevel BW png) in pdf; fixes # 2059 --- src/api/pdfrenderer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/api/pdfrenderer.cpp b/src/api/pdfrenderer.cpp index 79ba14937..9d5034e3d 100644 --- a/src/api/pdfrenderer.cpp +++ b/src/api/pdfrenderer.cpp @@ -721,7 +721,12 @@ bool TessPDFRenderer::imageToPDFObj(Pix *pix, } else { switch (cid->spp) { case 1: - colorspace.str(" /ColorSpace /DeviceGray\n"); + if (cid->bps == 1) { + colorspace.str(" /ColorSpace /DeviceGray\n" + " /Decode [1 0]\n"); + } else { + colorspace.str(" /ColorSpace /DeviceGray\n"); + } break; case 3: colorspace.str(" /ColorSpace /DeviceRGB\n");