Comment 8 for bug 657094

Revision history for this message
Fritz Scholz (fw-scholz) wrote : Re: [Bug 657094] Re: Evince when printing a pdf creates strange gapping.

Thanks John for throwing light on this and providing a solution.
Will try to fix it and play with it.

Sorry for the delay in my response. I had major computer problems and
was updating to Ubuntu 14.04 on 3 machines.

Best regards,

Fritz

-----Original Message-----
From: John McPherson
Sent: Thursday, October 23, 2014 1:17 AM
To: <email address hidden>
Subject: [Bug 657094] Re: Evince when printing a pdf creates strange
gapping.

This happens because cairo is putting newline "\n" characters into the
stream when creating PDF files (before compressing the stream), in an
attempt to do word-wrapping to keep the line size short (I think 72
columns?).

PDFs created like this appear ok on screen in evince, ghostscript etc,
but some printers don't like this - our institution has big Fuji Xerox
machines and these newline characters get turned into several spaces,
which screws up the horizontal spacing at what looks like random
character positions.

For example, here is an extract of a deflated stream from one such PDF
file:

[(M358)-10( )]TJ
-13.196 -1.15 Td
[(The Univ)-6(er)3(s)-4(i)-4(t)-8(y)11( of)-9( W)-3(es)-4(tern Aus)-4(tra\
li)-5(a )]TJ

on screen it looks like
"M358
The University of Western Australia"

but printed it becomes
"M358
The University of Western Austra lia"

The original PDF file doesn't have this, but evince uses libcairo to
create the print data, so the file sent to CUPS has the "\\\n" added to
the middle of strings in the stream. Printing the original PDF file
directly with lpr does not have this problem.

The code that is doing this is the
_word_wrap_stream_count_string_up_to() function in src/cairo-pdf-
operators.c

            } else if (stream->column > stream->max_column) {
                newline = TRUE;
                break;
            }
...
    if (newline) {
        _cairo_output_stream_printf (stream->output, "\\\n");
        stream->column = 0;
    }

if either of these bits of code is disabled, then the problem is fixed.

--
You received this bug notification because you are subscribed to the bug
report.
https://bugs.launchpad.net/bugs/657094

Title:
  Evince when printing a pdf creates strange gapping.

Status in “cairo” package in Ubuntu:
  Confirmed

Bug description:
  When trying to print a pdf file with Evince Document Viewer 2.30.3 in
Ubuntu 10.04 it creates strange gapping that seems to be due to Courier
font.
  These gaps show up when I print this file to pdf. Example file is
attached.
  They do not show when I print to pdf from within Acrobat Reader.
  I never had this problem before, but I recently upgraded to Ubuntu 10.04
from 8.04, and I can't recall which version
  of Evince I was using before.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cairo/+bug/657094/+subscriptions