Gentoo Archives: gentoo-user

From: Rich Freeman <rich0@g.o>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Scanning double sided documents and printing them the same.
Date: Thu, 10 Dec 2020 15:37:48
Message-Id: CAGfcS_nRnKM2RKSeb2mQ3qnnFQWDP3xoCtjbzqu=JdjvZ9huxA@mail.gmail.com
In Reply to: [gentoo-user] Scanning double sided documents and printing them the same. by Dale
1 On Wed, Dec 9, 2020 at 7:09 PM Dale <rdalek1967@×××××.com> wrote:
2 >
3 > How do I print them the
4 > same way tho?
5
6 I didn't see much discussion on the printing side of this - how to
7 print two-sided on a one-sided printer.
8
9 Step 1 (optional): I created a CUPS queue for such jobs that just
10 outputs everything into PDF in a directory. This lets you easily
11 print stuff that isn't already PDF from various computers/OSes and
12 accumulate a bunch as printing this way is easier in bulk since it
13 involves a bit of manual manipulation.
14
15 Step 2 (optional): I have a script that takes each PDF and adds a
16 blank page if needed to result in an even number of pages, then
17 concatenates all the PDFs into a single file. I probably stole this
18 from somewhere:
19
20 #!/bin/bash
21 for file in *.pdf
22 do
23 #get the number of pages
24 numberofpages=`pdftk "$file" dump_data | sed -e
25 '/NumberOfPages/!d;s/NumberOfPages: //'`
26 echo -n "$file" 'has' $numberofpages 'pages, '
27
28 uneven=$(($numberofpages % 2))
29 if [ $uneven == 1 ]
30 then
31 echo 'which is uneven - added 1 more'
32 tempfile=`mktemp`
33 pdftk A="$file" B=/usr/local/share/blank.pdf cat A B1 output "$tempfile"
34 mv $tempfile $file
35 else
36 echo 'which is even'
37 fi
38 done
39
40 pdftk *.pdf cat output out.pdf
41
42 Step 3: To print a single PDF double-sided follow this guide:
43 http://duramecho.com/ComputerInformation/HowToDoTwoSidedPrinting/index.html
44
45 So the idea is that I accumulate a bunch of documents to print this
46 way, combine them such that they can be printed all at once, and then
47 do the page flip technique in that guide. No need to worry about
48 individual pages as long as you ID which type of printer you have and
49 follow the appropriate process. However, to print multiple documents
50 at once this way they all have to have an even number of pages, which
51 is why I have the script. Concatenating the files with blank pages
52 added means that you can just print the whole thing once, flip, then
53 print it again, and it all works.
54
55 --
56 Rich

Replies

Subject Author
Re: [gentoo-user] Scanning double sided documents and printing them the same. "J. Roeleveld" <joost@××××××××.org>