From 82b322f2bba9efb5a8701c477a156dc207729d1a Mon Sep 17 00:00:00 2001 From: JaiLuthra1 Date: Thu, 16 Jan 2020 16:37:37 +0530 Subject: [PATCH] Added zero-page handling for texttopdf filter. --- filter/textcommon.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/filter/textcommon.c b/filter/textcommon.c index 97a1a7cc5..1c937ccab 100644 --- a/filter/textcommon.c +++ b/filter/textcommon.c @@ -22,6 +22,7 @@ #include "textcommon.h" #include +#include "pdfutils.h" /* @@ -536,6 +537,21 @@ TextMain(const char *name, /* I - Name of filter */ } } + fseek(fp, 0L, SEEK_END); + int size = ftell(fp); + fseek(fp, 0L, SEEK_SET); + + if(size==0) + { + if(fp!=stdin) + fclose(fp); + pdfOut *pdf=pdfOut_new(); + pdfOut_begin_pdf(pdf); + pdfOut_finish_pdf(pdf); + pdfOut_free(pdf); + return 0; + } + /* * Process command-line options and write the prolog... */ -- 2.47.2