From bbc9057b65f2032524a6b11e51b9b4f91b36ee12 Mon Sep 17 00:00:00 2001 From: Steven Lee Date: Mon, 10 Mar 2014 16:02:06 +0800 Subject: [PATCH] Update TiffWriter.cc Fix bug when using pdftoppm or pdftocairo to convert PDF to TIFF always gets "Error writing TIFF header" under Windows --- goo/TiffWriter.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/goo/TiffWriter.cc b/goo/TiffWriter.cc index d372a5b..ca93005 100644 --- a/goo/TiffWriter.cc +++ b/goo/TiffWriter.cc @@ -17,6 +17,10 @@ #include +#ifdef _WIN32 +#include +#endif + extern "C" { #include } @@ -151,7 +155,13 @@ bool TiffWriter::init(FILE *openedFile, int width, int height, int hDPI, int vDP return false; } +#ifdef _WIN32 + //Convert C Library handle to Win32 Handle + priv->f = TIFFFdOpen(_get_osfhandle(fileno(openedFile)), "-", "w"); +#else priv->f = TIFFFdOpen(fileno(openedFile), "-", "w"); +#endif + if (!priv->f) { return false; -- 1.8.5.5