Added zero-page handling for texttopdf filter.
#include "textcommon.h"
#include <limits.h>
+#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...
*/
