Back page margins are not correct

2015-04-06
2015-04-15
  • I'm using GMD on Arch linux with CUPS 2.0.2. GMD works fine but the pages that print when reinserting paper in the printer have different margins. When using Manual Long Edge, the content is closer to the top edge and if the document has small margins, part of the content is truncated.
    I noticed this on different printers (HP Laserjet 1102, HP Laserjet 200 MFP276 and Canon MP250). This issue is around since the upgrade to CUPS 2.x.

    I'm ready to help to debug.

     
  • $ gnome-manual-duplex ~/2pages.pdf
    {ps,pdf}tops '2:0' '/home/rick/2pages.pdf' /tmp/tmpYaZxKD
    [1] Wrote 1 pages, 14966 bytes
    {ps,pdf}tops '2:-1U(1w,1h)' '/home/rick/2pages.pdf' /tmp/tmpYaZxKD
    [1] Wrote 1 pages, 15199 bytes

    Looks right to me.

     
  • PSTOPS(1) General Commands Manual PSTOPS(1)

    NAME
    pstops - shuffle pages in a PostScript file

    ... snipped ...

       The -p  option  can  be  used  as  an
       alternative,  to  set  the paper size to a3, a4, a5, b5, letter, legal,
       tabloid, statement, executive, folio, quarto, 10x14  or  _glibc,  where
       latter  one  means  the format of the current locale. The default paper
       size is _glibc.
    

    ... snipped ...

    ENVIRONMENT VARIABLES
    LC_ALL, LC_PAPER
    These variables are specifying the papertype when used paper is
    _glibc. For details see the locale(7) manpage.

    Look like your LC_PAPER isn't set, or you don't have a patched psutils. The patch in Fedora is dated 2001 !!!

     
  • $ LC_PAPER="en_UK.utf8" pstops -q '2:-1U(1w,1h)' ~/2-a4.ps | grep "00000 translate"
    595.000000 842.000000 translate

    $ LC_PAPER="en_US.utf8" pstops -q '2:-1U(1w,1h)' ~/2-a4.ps | grep "00000 translate"
    612.000000 792.000000 translate

     
  • Debian/Ubuntu: patch for paper

     
    Attachments
  • I have psutils 1.17 (Arch has always the latest stable version of its packages).

    I typed "locale" in a terminal and got this:
    LANG=en_GB.utf8
    LC_CTYPE="en_GB.utf8"
    LC_NUMERIC="en_GB.utf8"
    LC_TIME="en_GB.utf8"
    LC_COLLATE="en_GB.utf8"
    LC_MONETARY="en_GB.utf8"
    LC_MESSAGES="en_GB.utf8"
    LC_PAPER="en_GB.utf8"
    LC_NAME="en_GB.utf8"
    LC_ADDRESS="en_GB.utf8"
    LC_TELEPHONE="en_GB.utf8"
    LC_MEASUREMENT="en_GB.utf8"
    LC_IDENTIFICATION="en_GB.utf8"

     
    Last edit: Christopher Vella 2015-04-07
  • You need psutils 1.17 PLUS at least the paper/pagesize patch from Fedora which uses the Locale, or Debian/Ubuntu which uses /etc/paper<something>. psutils 1.17 was released in 1995! Its got plenty of patches.

    Otherwise, I have put gmd 0.60 in the files section.

     
  • Your psutils has zero patches to it. Arch Linux really sucks.

     
  • I tried GMD 0.6 and the problem is worse. Now I have the same problem with both the front and back page. Both pages are cropped and with wrong margins.

     
  • What does:

    $ system-config-printer
    <printer> -> Printer Options -> Page size

    say? Looks like you are running in "Letter" page size, instead of "A4" page size. I did this:

    $ gnome-manual-duplex ~/2-a4.ps
    {ps,pdf}tops '2:0' '/home/rick/2-a4.ps' /tmp/tmpqnjbuW
    [1] Wrote 1 pages, 207322 bytes
    {ps,pdf}tops -pa4 '2:-1U(1w,1h)' '/home/rick/2-a4.ps' /tmp/tmpqnjbuW
    [1] Wrote 1 pages, 207555 bytes

    with gmd Page size set to A4 and with system-config-printer Page size set to A4 and it all works fine.

     
    Last edit: Rick Richardson 2015-04-09
    Attachments
  • Both the physical printer and the virtual one (GMD) are set to A4. I tried modifying the script by removing all other paper size alternatives and by changing the -p option to -paper to no avail. I tried recompiling psutils but didn't manage to patch it. It's giving me errors.

     
  • Did this on a VM running Antergos, with cups 2.0.1, gmd Page size set to A4 and with system-config-printer Page size set to A4.

    No problems at all. I am convinced you have Letter set in system-config-printer.

     
  • You have to set

    $ gnome-manual-duplex

    Page Size. It should be "Default (use locale)" for Fedora, Ubuntu/Debian, Slackware, etc. and A4 for Arch Linux.

     
    Attachments
  • I discovered something interesting. When I try to print a pdf through Okular that is not A4 size but I want it resized to A4 size, when printing straight to the printer it is scaled to fit (there's no setting though) while when I use GMD no scaling takes place and I get big margins and cropping.
    I tried printing using evince and enabling the "scale to fit" setting and it printed correctly. So, it seems that the problem is not with page size but with scaled pages. I tried printing a small pdf intended for ebook readers and hardly any text was in the printed document when using GMD through Okular.

    I also tried printing the 2-a4.ps test document and it printed correctly even with Okular. This confirms that the problem is related to scaling of pages.

     
  • I spoke too early. GMD prints perfectly with A4 documents when choosing "Print to PDF" as the destination printer but still crops the top of the page when printing to a physical printer.

     
  • $ gnome-manual-duplex ~/2-a4.ps
    {ps,pdf}tops '2:0' '/home/rick/2-a4.ps' /tmp/tmpqnjbuW
    [1] Wrote 1 pages, 207322 bytes
    {ps,pdf}tops -pa4 '2:-1U(1w,1h)' '/home/rick/2-a4.ps' /tmp/tmpqnjbuW
    [1] Wrote 1 pages, 207555 bytes

    Works fine here printing to an HP 1020 printer using MY open source foo2zjs drivers, not HP's closed source drivers.