All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: printing-architecture@lists.linux-foundation.org
Subject: [Printing-architecture] [PATCH] braille: Fix banner page printing
Date: Sun, 10 Apr 2016 18:34:11 +0200	[thread overview]
Message-ID: <20160410163411.GU2992@var.home> (raw)
In-Reply-To: <20160410162936.GR2992@var.home>

[-- Attachment #1: Type: text/plain, Size: 268 bytes --]

Banners use the application/vnd.cups-pdf-banner MIME type instead of
application/pdf, so recognize that as well.  Also, the banner file can
not be opened by the script, we have to really just use the standard
input, and not try to reopen /dev/stdin, which would fail.

[-- Attachment #2: patch3 --]
[-- Type: text/plain, Size: 2370 bytes --]

=== modified file 'filter/braille/filters/texttobrf.in'
--- filter/braille/filters/texttobrf.in	2016-01-21 01:10:01 +0000
+++ filter/braille/filters/texttobrf.in	2016-04-10 16:06:59 +0000
@@ -71,7 +71,7 @@ setupTextRendering() {
       checkTool lynx lynx "translating html files"
       ;;
     application/msword)
-      CONVERT="antiword /dev/stdin"
+      CONVERT="antiword -"
       checkTool antiword antiword "translating MS-Word doc files"
       ;;
     application/vnd.openxmlformats-officedocument.wordprocessingml.document)
@@ -82,8 +82,8 @@ setupTextRendering() {
       CONVERT="rtf2txt /dev/stdin"
       checkTool rtf2txt rtf2txt "translating RTF files"
       ;;
-    application/pdf)
-      CONVERT="pdftotext -raw /dev/stdin /dev/stdout"
+    application/pdf|application/vnd.cups-pdf-banner)
+      CONVERT="pdftotext -raw - -"
       checkTool pdftotext poppler "translating PDF files"
       ;;
     *)
@@ -114,7 +114,7 @@ then
 	;;
       application/msword)
 	LIBLOUIS_TOOL="file2brl"
-	CONVERT="antiword -x db /dev/stdin"
+	CONVERT="antiword -x db -"
 	checkTool antiword antiword "translating MS-Word doc files"
 	;;
       application/vnd.openxmlformats-officedocument.wordprocessingml.document)
@@ -127,9 +127,9 @@ then
 	CONVERT="rtf2xml /dev/stdin"
 	checkTool rtf2xml rtf2xml "translating RTF files"
 	;;
-      application/pdf)
+      application/pdf|application/vnd.cups-pdf-banner)
 	LIBLOUIS_TOOL="file2brl -p"
-	CONVERT="pdftotext -raw /dev/stdin /dev/stdout"
+	CONVERT="pdftotext -raw - -"
 	checkTool pdftotext poppler "translating PDF files"
 	;;
       *)
@@ -156,19 +156,33 @@ fi
 # Now proceeed
 cd $TMPDIR
 echo "INFO: Reformating text" >&2
-[ -z "$FILE" ] && FILE=/dev/stdin
 
 if [ -z "$CONVERT" ]
 then
   printf "DEBUG: Calling $RENDER_CALL on '%s'\n" "$FILE" >&2
+  if [ -z "$FILE" ]
+  then
+    $RENDER_CALL
+  else
    < "$FILE" $RENDER_CALL
+  fi
 elif [ -z "$TRANSLATE" ]
 then
   printf "DEBUG: Calling $CONVERT | $RENDER_CALL on '%s'\n" "$FILE" >&2
+  if [ -z "$FILE" ]
+  then
+    $CONVERT | $RENDER_CALL
+  else
   < "$FILE" $CONVERT | $RENDER_CALL
+  fi
 else
   printf "DEBUG: Calling $CONVERT | $RENDER_CALL | $TRANSLATE on '%s'\n" "$FILE" >&2
+  if [ -z "$FILE" ]
+  then
+    $CONVERT | $RENDER_CALL | $TRANSLATE
+  else
   < "$FILE" $CONVERT | $RENDER_CALL | $TRANSLATE
+  fi
 fi
 
 echo "INFO: Ready" >&2


  parent reply	other threads:[~2016-04-10 16:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-10 16:29 [Printing-architecture] [PATCH] braille: various fixes Samuel Thibault
2016-04-10 16:31 ` [Printing-architecture] [PATCH] braille: index: Avoid spurious EOF character Samuel Thibault
2016-04-10 16:32 ` [Printing-architecture] [PATCH] braille: drop spurious output from tool checking Samuel Thibault
2016-04-10 16:34 ` Samuel Thibault [this message]
2016-04-10 17:25 ` [Printing-architecture] [PATCH] braille: various fixes Till Kamppeter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160410163411.GU2992@var.home \
    --to=samuel.thibault@ens-lyon.org \
    --cc=printing-architecture@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.