From 5118029d4d0ba5bcb27cbef2b3245c9fb654f72c Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Wed, 7 Aug 2013 13:09:17 +0400 Subject: [PATCH] Fix `pdftotext -bbox in.pdf -` Print body text to stdout if invoked as above. https://bugs.freedesktop.org/show_bug.cgi?id=45163 --- utils/pdftotext.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/utils/pdftotext.cc b/utils/pdftotext.cc index a170f1b..b83eb4a 100644 --- a/utils/pdftotext.cc +++ b/utils/pdftotext.cc @@ -331,21 +331,17 @@ int main(int argc, char *argv[]) { info.free(); fputs("\n", f); fputs("\n", f); - if (!bbox) fputs("
\n", f);
-    if (f != stdout) {
-      fclose(f);
+    if (!bbox) {
+      fputs("
\n", f);
+      if (f != stdout) {
+	fclose(f);
+      }
     }
   }
 
   // write text file
   if (bbox) {
     textOut = new TextOutputDev(NULL, physLayout, fixedPitch, rawOrder, htmlMeta);
-    if (!(f = fopen(textFileName->getCString(), "ab"))) {
-      error(errIO, -1, "Couldn't open text file '{0:t}' for append", textFileName);
-      exitCode = 2;
-      delete textOut;
-      goto err3;
-    }
 
     if (textOut->isOk()) {
       fprintf(f, "\n");
-- 
1.8.1.2