Discussion:
[gs-bugs] [Bug 698693] - Ghostscript - clipped text is selectable in pdf
b***@artifex.com
2017-10-25 08:41:24 UTC
Permalink
http://bugs.ghostscript.com/show_bug.cgi?id=698693

Bug ID: 698693
Summary: clipped text is selectable in pdf
Product: Ghostscript
Version: 9.22
Hardware: PC
OS: Windows NT
Status: UNCONFIRMED
Severity: normal
Priority: P4
Component: PDF Writer
Assignee: ***@artifex.com
Reporter: ***@fee.de
QA Contact: gs-***@ghostscript.com
Word Size: ---

Created attachment 14413
--> http://bugs.ghostscript.com/attachment.cgi?id=14413&action=edit
sample files

Hi,

in 9.21, clipped text didn't make it into the pdf file and hence, wasn't
selectable.

In 9.22, clipped text makes it into the pdf file for some input.

Let's have a look into the attached file.

hiddenPrinted_unfiltered.pdf shows the text '@@mailfrom:hidden'. This file was
created like that using GhostScript 9.22:

gswin32c.exe -dNOPAUSE -dBATCH -sDEVICE=pdfwrite
-sOutputFile=hiddenPrinted_unfiltered.pdf -c save pop .setsafe -f
hiddenPrinted.ps

To clip away that text, I've used this command:

gswin32c.exe -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=hiddenPrinted.pdf
-c save pop -f mailFilterText.ps -c .setsafe -f hiddenPrinted.ps

As hiddenPrinted.png shows, the text doesn't render anything on the page, but
can be selected in AcrobatReader.

I used GhostScript 9.21 for running the last command to create
hiddenPrinted_921.pdf. In that file, the clipped text is not selectable, so it
looks like a bug was introduced in 9.22.

How does the clipping work? mailFilterText.ps analyses the text passed to the
show operators and when the text starts with @@ and has at least a certain
lenght, it considers the text as control command which must not be rendered
into the page, so it runs the show operator in a grafics context with an empty
clipping rectangle.

hiddenCoded.ps demontrates the clipping, which always works even when using
GhostScript 9.22.

If you run the above commands with hiddenCoded.ps instead of hiddenPrinted.ps,
you'll get hiddenCoded_unfiltered.pdf for example, which demonstrates the
clipping. The clipped text is not selectable in AcrobatReader.

If you combine it with mailFilterText.ps, you'll get hiddenCoded.pdf. The
control command has now been clipped too, and as hiddenCoded.png shows, the
only selectable text in AcrobatReader is 'not hidden'.

I've no idea, what parts in the input files make GhostScript 9.22 behave
differently. But as 9.21 behaves as expected, I think a bug was introduced in
9.22.

Bye.
--
You are receiving this mail because:
You are the QA Contact for the bug.
b***@artifex.com
2017-10-25 09:15:03 UTC
Permalink
http://bugs.ghostscript.com/show_bug.cgi?id=698693

--- Comment #1 from Ken Sharp <***@artifex.com> ---
Frankly we don't make any guarantees about eliding content. Apparently your
PostScript draws text outside a clipping region, the PDF draws text outside a
clipping region. So the two are analogous, the visual appearance is the same in
each case which is all we aim for. Arguably the second file is better, because
it preserves more of the semantics of the input.

The problem is probably the fact that the clip is degenerate. However, it would
help a great deal if you could come up with a *much* simpler example.

The 'hiddenCoded' files just add to my confusion, because I'm really not
interested in a 'working' path, that doesn't tell me anything useful.

I'd really like a nice simple single PostScript file with one character that
demonstrates the change. All the text that isn't part of the problem simply
obscures it, as does the 12Kb of redefinition of the PostScript environment.
--
You are receiving this mail because:
You are the QA Contact for the bug.
b***@artifex.com
2017-10-25 11:55:36 UTC
Permalink
http://bugs.ghostscript.com/show_bug.cgi?id=698693

--- Comment #2 from Reinhard Nißl <***@fee.de> ---
Created attachment 14414
--> http://bugs.ghostscript.com/attachment.cgi?id=14414&action=edit
simple test files

Hi Ken,

I've created a simplier test case which renders a single character 'X' (see
line 1234 of simple.ps).

simple_921.pdf shows the result of running GhostScript 9.21 like that:

gswin32c.exe -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=simple_921.pdf -c
save pop .setsafe -f simple.ps

And simple_922.pdf was created using GhostScript 9.22.
simple_922.png shows the selected character 'X' in AcrobatReader.

Hope this helps to trackdown the issue.

Bye.
--
You are receiving this mail because:
You are the QA Contact for the bug.
b***@artifex.com
2017-10-25 13:58:54 UTC
Permalink
http://bugs.ghostscript.com/show_bug.cgi?id=698693

Ken Sharp <***@artifex.com> changed:

What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED

--- Comment #3 from Ken Sharp <***@artifex.com> ---
(In reply to Reinhard Nißl from comment #2)
Post by b***@artifex.com
Hope this helps to trackdown the issue.
Yes that's *much* easier. Fix committed as
d9d74def0095641f20b46716c929bc6f88154490
--
You are receiving this mail because:
You are the QA Contact for the bug.
b***@artifex.com
2017-10-25 14:05:17 UTC
Permalink
http://bugs.ghostscript.com/show_bug.cgi?id=698693

--- Comment #4 from Ken Sharp <***@artifex.com> ---
Oops.... You should also pick up commit
f13a659f9700fac0a0f47007c1eaacddd5c7f208
--
You are receiving this mail because:
You are the QA Contact for the bug.
Loading...