Bug 45955

Summary: copying text from a PDF document in evince adds a newline
Product: poppler Reporter: Pacho Ramos <pachoramos1>
Component: generalAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Pacho Ramos 2012-02-12 09:03:27 UTC
Any text selected and copied from a PDF document in evince, both via Ctrl-C and
the right-click menu, gets a newline appended at the end when pasted into
another program. Happens with every single pdf document that I have tried.

As discussed downstream in:
https://bugs.gentoo.org/show_bug.cgi?id=402071

This seems to be caused by poppler-0.18.3 and can be fixed with the following patch:
https://bugs.gentoo.org/show_bug.cgi?id=402071#c5
Comment 1 Albert Astals Cid 2012-02-12 11:19:49 UTC
Are you saying this is new behaviour in poppler 0.18.3?
Have you verified your patch does not change pdftotext output?
Comment 2 Pacho Ramos 2012-02-14 00:42:01 UTC
From downstream report:

> Are you saying this is new behaviour in poppler 0.18.3?
No. As far as I can see the relevant part of TextOutputDev.cc is the same in
poppler-0.16.7. The behavior is new to me only because I solely used xpdf over
the last decade and even the 'popplerized' xpdf in gentoo is not affected (I
think it doesn't use poppler for text copying).
> Have you verified your patch does not change pdftotext output?
I just did a pdftotext of two pages of an pdf document with and without my
patch applied and diff says the output is identical. And I'm very confident
that this will always be ok as my change is in function
TextSelectionDumper::getText which as far as I can see is not used by
pdftotext.
Comment 3 Albert Astals Cid 2012-02-14 10:09:22 UTC
Not cairo backend related (TextSelectionDumper is only used by it but that doesn't mean it is cairo backend exclusive).
Comment 4 Albert Astals Cid 2012-02-14 10:13:04 UTC
Carlos since it mostly affects the glib frontend (it's the only user of the TextSelectionDumper stuff) i'll leave it for you
Comment 5 Adrian Johnson 2012-03-26 03:43:22 UTC
I checked acroread and it does not append a newline to the last line of copied text.

I've tested the patch linked to in comment 0 and it fixes the problem. Carlos indicated on irc he has no objection to pushing the patch.

Patch pushed.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.