9

I have a printer (Samsung M2022W) which doesn't support duplex printing.

However, I would like to manually print on both sides (that is to say, print even pages, then insert these pages again on the printer and launch the odd pages). The problem is that I don't have a "manual duplex" option on my Debian system. And there is not even a "odd/even pages only" option.

How can I simply print manually on both sides on *unix?

8 Answers 8

5

I know it's a little late for an answer for the OP, but anyone finding this might want to check out my duplexpr project on sourceforge. It not only emulates duplex printing for non-duplex printers, but also allows you to print more than one print job at a time in a batch so that you only have to remove and reinsert the pages once for the whole batch.

Duplexpr supports both command line and gui interfaces. It's is written in bash with a number of reusable functions so it's relatively easy to modify. I've been using it daily for over a decade with several different printers and am continuing to develop it.

If you just want to print duplex once in awhile or need to access all the fancy features which your printer supports, then also check out xpp. It will do almost anything your printer can do, but you have to tell it what you want each time which can get a little old if you use it a lot.

0
3

Try

$ lp -o page-set=odd filename
# ... manually flip pages ...
$ lp -o page-set=even filename

from the docs here.

2
  • Thanks. But I was more looking for a graphical solution (adding a option "manual duplex").
    – ppr
    Aug 20, 2014 at 15:18
  • Make the command "lpr ..." and it work here (Fedora 24).
    – vonbrand
    Nov 6, 2016 at 17:56
3

There's a package called gnome-manual-duplex. It works for many printers out of the box. For others it may require manual setting.

1
  • Worked well for me lubuntu 18.04 with deskjet 2130. But it took some printing to get used to it.
    – ptetteh227
    Jun 22, 2018 at 23:41
3

If you are using HP-Lazerjet 1020, you can use these commands:

lp -o page-set=odd filename

after printer print the odd numbered pages, pull the papers and place them to tray exactly how it is (without turning or rotating). Then run the second command to print the even numbered pages:

lp -o page-set=even -o orientation-requested=6 -o outputorder=reverse filename

Now printing should be finished

Note: -o orientation-requested=6 turns the pages 180 degrees and -o outputorder=reverse prints pages by reverse order tested on HP-Lazerjet 1020

1
  • doesn't work if you have an odd number of pages. should work if you replaced the order of commands: first print the even pages, then the odd ones. That way, the last odd page is printed on the fresh sheet of paper
    – aurelia
    Feb 11, 2023 at 0:02
0

I wrote a simple shell script for manual duplex printing. Use lpoptions -l to find print options supported by your printer.

Printer=DeskJet-2130-series
PageSize=A4
InputSlot=Main
ColorModel=KGray
MediaType=Plain
OutputMode=Normal

file_list=()
print_status=()
file_count=0

red=$'\e[1;31m'
grn=$'\e[1;32m'
yel=$'\e[1;33m'
blu=$'\e[1;34m'
mag=$'\e[1;35m'
cyn=$'\e[1;36m'
end=$'\e[0m'

current_file=0

for file in "$@"    
do
    echo "$file"
    file_list[$file_count]=$file
    print_status[$file_count]="pending"
    file_count=$((file_count+1))
done

function print_status_text() {
    fmt="%-100s%-12s\n"
    for ((i=0;i<$file_count;i++))
    do
        file=${file_list[$i]}
        status=${print_status[$i]}
        
        if [ $status == "pending" ]
        then
            printf "$fmt" "${blu}$file${end}" "${blu}$status${end}"
        elif [ $status == "ready" ]
        then
            printf "$fmt" "${mag}$file${end}" "${mag}$status${end}"
        elif [ $status == "printing" ] || [ $status == "processing" ]
        then
            printf "$fmt" "${yel}$file${end}" "${yel}$status${end}"
        elif [ $status == "skipped" ]
        then
            printf "$fmt" "${red}$file${end}" "${red}$status${end}"
        else
            printf "$fmt" "${grn}$file${end}" "${grn}$status${end}"
        fi
    done
}

trap ctrl_c INT

function ctrl_c() {
        for ((e=$current_file;e<$file_count;e++))
    do
        print_status[$e]="skipped"
    done
    clear
    print_status_text
    exit 0
}

for ((n=0;n<$file_count;n++))
do
    current_file=$n
    clear
    file=${file_list[$n]}
    print_status[$n]="ready"
    print_status_text
    echo ""
    echo -e "\e[93m\e[5mPress enter to START printing...\e[0m\e[0m"
    read -p ""
    clear
    print_status[$n]="processing"
    print_status_text
    # separate even and odd pages
    # remove old temp files
    if [ -f "/tmp/odd.pdf" ]; then
        rm "/tmp/odd.pdf"
    fi
    if [ -f "/tmp/even.pdf" ]; then
        rm "/tmp/even.pdf"
    fi
    pdftk "$file" cat odd output /tmp/odd.pdf && pdftk "/tmp/odd.pdf" cat end-1 output "/tmp/out.pdf" && rm /tmp/odd.pdf && mv /tmp/out.pdf /tmp/odd.pdf >> /dev/null
    pdftk "$file" cat even output /tmp/even.pdf && pdftk "/tmp/even.pdf" cat end-1 output "/tmp/out.pdf" && rm /tmp/even.pdf && mv /tmp/out.pdf /tmp/even.pdf >> /dev/null
    evenCount=$(pdfinfo /tmp/even.pdf | awk '/^Pages:/ {print $2}')
    oddCount=$(pdfinfo /tmp/odd.pdf | awk '/^Pages:/ {print $2}')
    
    if [ $evenCount -gt 0 ] && [ $evenCount -lt $oddCount ]; then
        # create blank pdf if not exists
        if [ ! -f "/tmp/blank.pdf" ]; then
            convert xc:none -page A4 /tmp/blank.pdf
        fi
        # join blank pdf and even pdf
        pdftk /tmp/blank.pdf /tmp/even.pdf cat output /tmp/out.pdf
        rm /tmp/even.pdf
        mv /tmp/out.pdf /tmp/even.pdf
    fi
    
    if [ $oddCount -lt $evenCount ]; then
        # create blank pdf if not exists
        if [ ! -f "/tmp/blank.pdf" ]; then
            convert xc:none -page A4 /tmp/blank.pdf
        fi
        # join blank pdf and even pdf
        pdftk /tmp/blank.pdf /tmp/odd.pdf cat output /tmp/out.pdf
        rm /tmp/odd.pdf
        mv /tmp/out.pdf /tmp/odd.pdf
    fi
    
    clear
    
    # print even pages
    if [ $evenCount -gt 0 ]; then
        lp -d "$Printer" -o PageSize="$PageSize" -o InputSlot="$InputSlot" -o ColorModel="$ColorModel" -o MediaType="$MediaType" -o OutputMode="$OutputMode" "/tmp/even.pdf" > /dev/null
        print_status[$n]="printing"
        print_status_text
        echo ""
        echo -e "\e[95m\e[5mPress enter to print SIDE TWO...\e[0m\e[0m"
        read -p ""
    fi
    clear
    
    # print odd pages
    if [ $oddCount -gt 0 ]; then
        lp -d "$Printer" -o PageSize="$PageSize" -o InputSlot="$InputSlot" -o ColorModel="$ColorModel" -o MediaType="$MediaType" -o OutputMode="$OutputMode" "/tmp/odd.pdf" > /dev/null
    fi
    print_status[$n]="completed"
    print_status_text
done
0

You can try boomaga (github link) for this manual duplex printing feature.

1
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review Apr 10, 2023 at 16:28
0

The simplest way is to install one of the manual duplexing programs found out there.

Since it's made by me, https://github.com/dentys03/manual_duplex_linux seems simplest to install and to run:

  • It has a command line installer;
  • A graphical interface which pops out of nowhere when you print;
  • It's installing a fake printer to which you'll send your documents for printing;
  • Doesn't use external programs which you won't find already installed in your linux box(tested on Ubuntu and Debian);
  • Doesn't have complicated options to confuse you - just prints on 2 sides.
-1

EDIT: This only worked for one job - had to turn the printer off then on again before the procedure worked for a new job. Your mileage may vary.

DISCLAIMER: I can't vouch for the safety of this procedure.

The might be a bit late but still relevant. I just tried this on a whim and it worked.

I lifted the toner cover lid and then placed it back - this was while the printer was waiting for the equivalent of a continue button push on windows (red LED blinking). Printer resumed the job to complete the duplex.

I had some print quality issues with HPLIP and so settled on the Foomatic driver instead (Foomatic/foo2xqx) - it provides the options I needed to support extra dark printing.

Ubuntu 16.05/x64 / Printer: HP LaserJet P1005
Driver: Foomatic/foo2xqx

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .