File: pdf_cslayer.ps

package info (click to toggle)
ghostscript 8.71~dfsg2-9+squeeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 79,896 kB
  • ctags: 80,654
  • sloc: ansic: 501,432; sh: 25,689; python: 4,853; cpp: 3,633; perl: 3,597; tcl: 1,480; makefile: 1,187; lisp: 407; asm: 284; xml: 263; awk: 66; csh: 17; yacc: 15
file content (121 lines) | stat: -rw-r--r-- 4,058 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
% Copyright (C) 2007 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
% implied.
%
% This software is distributed under license and may not be copied, modified
% or distributed except as expressly authorized under the terms of that
% license.  Refer to licensing information at http://www.artifex.com/
% or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
% San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
%
% $Id: pdf_cslayer.ps 8954 2008-08-08 04:22:38Z ray $
% 
% Layer data extraction from Illustator CS2/CS3 files
% 

.languagelevel dup 2 .max .setlanguagelevel
.currentglobal //true .setglobal
/pdfdict load dup /pdfopdict get dup length dict copy dup begin /pdfopdict exch put

/BMC {
  currentdevice //null //false mark
  /MarkType (BMC)
  /BMC_Tag  8 1 roll 256 string cvs
  //systemdict /CSLAYERDEBUG .knownget {
    { (### BMC to deviceparams, tag: ) print dup = flush } if
  } if
  .putdeviceparamsonly dup type /booleantype ne {
     cleartomark pop
  } if
  pop pop 	% discard the device and flag
  pop pop 	% discard /BMC_Tag and the tag name
} bind def

/BDC {	% send selected BDC info to the device as properties
  10 dict begin	% private working dictionary
  /MarkType (BDC) def	% BDC code
  % process the tag and Title for now
  exch 256 string cvs /BDC_Tag exch def	% convert tag to a string
  dup type /nametype eq {
    dup Page /Properties rget not {
      pop 0 dict	% empty dict in case missing Properties Resource
    } if
    exch pop		% discard the resource name
  } if

  dup /Type knownoget { /OCG eq } { //false } ifelse {
    % Illustrator CS3 and higher
    dup /Name knownoget not { () } if	% no Name, use an empty string
    /BDC_Title exch def

    dup /Usage knownoget not { 0 dict } if
    dup /View knownoget { /ViewState knownoget { /OFF ne } { //true } ifelse } { //true } ifelse
    /BDC_Visible exch def
    dup /Print knownoget { /PrintState knownoget { /OFF ne } { //true } ifelse } { //true } ifelse
    /BDC_Printed exch def
    pop  % Usage dict
 
    dup /Intent knownoget {
      dup type /nametype eq {
        /Design eq
      } {
        //false exch { oforce /Design eq or } forall
      } ifelse
    } {
      //false
    } ifelse
    /BDC_Editable exch def

    /BDC_Preview //true def
    /BDC_Dimmed //false def
    /BDC_Transparency //true def
    /BDC_FlatLayer //true def
  } {
    % Illustrator CS2
    dup /Title knownoget not { () } if	% no Title, use an empty string
    /BDC_Title exch def
    dup /Visible knownoget not { //true } if % no Visible flag, set true
    /BDC_Visible exch def
    dup /Preview knownoget not { //true } if % no preview flag, set true
    /BDC_Preview exch def
    dup /Editable knownoget not { //true } if % no Editable flag, set true
    /BDC_Editable exch def
    dup /Printed knownoget not { //true } if % no printed flag, set true
    /BDC_Printed exch def
    dup /Dimmed knownoget not { //true } if % no dimmed flag, set true
    /BDC_Dimmed exch def
    dup /Transparency knownoget not { //true } if % no Transparency flag, set true
    /BDC_Transparency exch def
    dup /FlatLayer knownoget not { //true } if % no flat layer flag, set true
    /BDC_FlatLayer exch def
  } ifelse

  % now send the collected info to the device
  //systemdict /CSLAYERDEBUG .knownget {
    { (### BDC info to deviceparams: ) print currentdict === flush } if
  } if
  currentdevice //null //false mark currentdict { } forall
  .putdeviceparamsonly dup type /booleantype ne {
    cleartomark pop
  } if
  pop pop 	% discard the device and flag
  end		% discard private dict
  pop		% done with properties dict
} bind def

/EMC {
  currentdevice //null //false mark /MarkType (EMC)
  //systemdict /CSLAYERDEBUG .knownget {
    { (### EMC to deviceparams) = flush } if
  } if
  .putdeviceparamsonly dup type /booleantype ne {
       cleartomark pop
  } if
  pop pop 	% discard the device and flag
} bind def

currentdict readonly pop end
.setglobal
.setlanguagelevel