[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1562-g8cc13d5
[email protected] (Ken Sharp)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
The ghostpdl branch, master has been updated
via 8cc13d54850af14a07e72f73cca20e96ed01fd03 (commit)
from 368bc91bf0bba66f31204e1ee57da7c9b70b32bb (commit)
----------------------------------------------------------------------
commit 8cc13d54850af14a07e72f73cca20e96ed01fd03
Author: Ken Sharp <[email protected]>
Date: Mon Aug 12 16:06:21 2019 +0100
PDF interpreter - ignore visibility of annotations for devices which support them
No bug for this, arose from a Stack Overflow question, but its a FAQ
as well.
It used to be the case that the PDF interpreter would (and should)
render files containing annotations with the Print and NoView flags
differently, depending on whether the destination was to be rendered
or sent to a high level device. This is controlled with the -dPrinted
flag to determine whether annotations should be treated as for a Print
device or a View device.
This doesn't make a lot of sense for pdfwrite though. We really want to
keep the Annotation 'as is' and let the viewer or printer of the output
PDF file deal with it.
In the past we've moved the annotation handling for pdfwrite and,
technically, for any device which directly supports annotations from
'drawannot' to 'preserveannot'. Now that we've done that, it makes some
sense to have the 'preserveannot' code no longer check the annotation's
visibility, but simply preserve it as you would expect. NOTE we do check
the visibility state of annotations that we don't know how to handle.
These will not be preserved as annotations, but will be drawn into the
page contents, so we don't want to render any which should be invisible.
Such annotations are still affected by -dPritned.
diff --git a/Resource/Init/pdf_draw.ps b/Resource/Init/pdf_draw.ps
index 2a779e3..11eb485 100644
--- a/Resource/Init/pdf_draw.ps
+++ b/Resource/Init/pdf_draw.ps
@@ -5042,18 +5042,17 @@ currentdict /drawannottypes undef
currentdict end readonly def
/preserveannot { % <annot> preserveannot -
-
dup /.gs.pdfobj# known {
dup /.gs.pdfobj# undef
} if
- dup annotvisible {
- gsave
- dup dup /Subtype knownoget {
- dup //.PDFDrawAnnotType? exec
+ gsave
+ dup dup /Subtype knownoget {
+ dup //.PDFDrawAnnotType? exec
+ {
+ //preserveannottypes exch .knownget { exec } { //true } ifelse
{
- //preserveannottypes exch .knownget { exec } { //true } ifelse
- {
+ dup annotvisible {
dup calc_annot_scale 2 copy mul 0 ne
{
3 -1 roll drawwidget
@@ -5062,18 +5061,20 @@ currentdict end readonly def
( **** Error: ignoring annotation with scale factor of 0\n) pdfformaterror
( Output may be incorrect.\n) pdfformaterror
}ifelse % Draw rejected annots as widgets
- } if
- }
- {pop} ifelse
- % type known
- } {
- pop
- ( **** Error: Ignoring /Annot dict without required /Subtype entry.\n)
- pdfformaterror
- ( Output may be incorrect.\n) pdfformaterror
- } ifelse
- grestore
- } if pop % annotvisible
+ } {
+ pop
+ }ifelse
+ } if
+ }
+ {pop} ifelse
+ % type known
+ } {
+ pop
+ ( **** Error: Ignoring /Annot dict without required /Subtype entry.\n)
+ pdfformaterror
+ ( Output may be incorrect.\n) pdfformaterror
+ } ifelse
+ grestore
} bind executeonly def
currentdict /preserveannottypes undef
Summary of changes:
Resource/Init/pdf_draw.ps | 39 ++++++++++++++++++++-------------------
1 file changed, 20 insertions(+), 19 deletions(-)