~ubuntu-branches/ubuntu/oneiric/ghostscript/oneiric

« back to all changes in this revision

Viewing changes to lib/pdfwrite.ps

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2011-07-15 16:49:55 UTC
  • mfrom: (1.1.23 upstream)
  • Revision ID: james.westby@ubuntu.com-20110715164955-uga6qibao6kez05c
Tags: 9.04~dfsg~20110715-0ubuntu1
* New upstream release
   - GIT snapshot from Jult, 12 2011.
* debian/patches/020110406~a54df2d.patch,
  debian/patches/020110408~0791cc8.patch,
  debian/patches/020110408~507cbee.patch,
  debian/patches/020110411~4509a49.patch,
  debian/patches/020110412~78bb9a6.patch,
  debian/patches/020110418~a05ab8a.patch,
  debian/patches/020110420~20b6c78.patch,
  debian/patches/020110420~4ddefa2.patch: Removed upstream patches.
* debian/rules: Generate ABI version number (variable "abi") correctly,
  cutting off repackaging and pre-release parts.
* debian/rules: Added ./lcms2/ directory to DEB_UPSTREAM_REPACKAGE_EXCLUDES.
* debian/copyright: Added lcms2/* to the list of excluded files.
* debian/symbols.common: Updated for new upstream source. Applied patch
  which dpkg-gensymbols generated for debian/libgs9.symbols to this file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
%    Copyright (C) 1999, 2000, 2001 Aladdin Enterprises.  All rights reserved.
2
 
 
2
%
3
3
% This software is provided AS-IS with no warranty, either express or
4
4
% implied.
5
 
 
5
%
6
6
% This software is distributed under license and may not be copied,
7
7
% modified or distributed except as expressly authorized under the terms
8
8
% of the license contained in the file LICENSE in this distribution.
9
 
 
9
%
10
10
% For more information about licensing, please refer to
11
11
% http://www.ghostscript.com/licensing/. For information on
12
12
% commercial licensing, go to http://www.artifex.com/licensing/ or
13
13
% contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14
14
% San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15
15
 
16
 
% $Id: pdfwrite.ps 9246 2008-11-27 01:58:54Z alexcher $
 
16
% $Id$
17
17
% Writer for transmuting PDF files.
18
18
 
19
19
% NOTES:
58
58
    put put
59
59
  } ifelse                   % -
60
60
} bind def
61
 
                    
 
61
 
62
62
/ld_known {         % <ldict> <key> ld_known <bool>
63
63
  dup 3 1 roll -15 bitshift  % key <<>> key<<15
64
64
  2 copy known {
67
67
    pop pop pop //false
68
68
  } ifelse
69
69
} bind def
70
 
                             
 
70
 
71
71
/ld_knownget {      % <ldict> <key> ld_known false | <any> true
72
72
  dup 3 1 roll -15 bitshift  % key <<>> key<<15
73
73
  2 copy known {
175
175
  dup xcheck {
176
176
    aload pop //pdfwriteprocs exch get exec
177
177
  } {
178
 
        % Because of a bug in Acrobat's parser for linearization parameters,
179
 
        % we have to include some whitespace after the opening [ (!).
 
178
        % Because of a bug in Acrobat's parser for linearization parameters,
 
179
        % we have to include some whitespace after the opening [ (!).
180
180
    ([ ) ows { pdfwritevalue (\n) ows } forall (]) ows
181
181
  } ifelse
182
182
} bind def
208
208
 
209
209
/pdfcopystring 200 string def
210
210
/pdfwritestream {       % <streamdict> pdfwritestream -
211
 
        % Remove File, FilePosition, and StreamKey;
212
 
        % optimize by replacing an indirect Length.
 
211
        % Remove File, FilePosition, and StreamKey;
 
212
        % optimize by replacing an indirect Length.
213
213
  dup dup length dict copy
214
 
        % Stack: origdict dict
 
214
        % Stack: origdict dict
215
215
  dup /File undef dup /FilePosition undef dup /StreamKey undef
216
216
  dup /Length known {
217
217
    dup /Length get dup oforce ne {
240
240
  } loop pop pop pop
241
241
} bind def
242
242
/pdfcopystream {        % <newstreamdict> <file> pdfcopystream -
243
 
                        %   (file has been positioned)
 
243
                        %   (file has been positioned)
244
244
  1 index pdfwritevalue (stream\n) ows
245
245
  exch /Length get OFile exch pdfcopybytes
246
246
  (endstream) ows
249
249
% ---------------- General values/objects ---------------- %
250
250
 
251
251
/pdfwritetypes mark
252
 
        % Scalars
 
252
        % Scalars
253
253
  /nulltype { pop (null) ows } bind
254
254
  /integertype { =string cvs ows } bind
255
255
  /booleantype 1 index
286
286
  } bind
287
287
  /stringtype { OFile exch write===only } bind
288
288
  /nametype { pdfwritename } bind
289
 
        % Composite/reference objects
 
289
        % Composite/reference objects
290
290
  /arraytype { pdfwritearray } bind
291
291
  /packedarraytype 1 index
292
292
  /dicttype { pdfwritedict } bind
338
338
  (trailer\n) ows
339
339
  % Since we always write a complete "classic" xref, the Trailer may need to be adjusted:
340
340
  % - remove keys that pertain to xref-streams and hybrid-xref PDFs;
341
 
  % - if it's a PDF stream, turn it into a PDF dict by removing keys used for 
 
341
  % - if it's a PDF stream, turn it into a PDF dict by removing keys used for
342
342
  %   PDF streams (both standard and GS-specific), and the executable attribute
343
343
  dup /XRefStm known 1 index xcheck or {
344
344
    dup length dict copy
364
364
  /ToWrite 100 dict def
365
365
  omapinit
366
366
 
367
 
        % Write the PDF file header.
 
367
        % Write the PDF file header.
368
368
 
369
369
  pdfwriteheader
370
370
 
371
 
        % Write the objects.
 
371
        % Write the objects.
372
372
 
373
373
  trailer {
374
374
    exch pop dup xcheck {       % The only executable objects are references.
377
377
      pop
378
378
    } ifelse
379
379
  } forall
380
 
        % Walk the object graph.
 
380
        % Walk the object graph.
381
381
  {
382
382
    ToWrite dup length dup 0 eq { pop pop exit } if
383
383
    1 sub 2 copy get 3 1 roll undef aload pop pdfwriteobj
384
384
  } loop
385
385
 
386
 
        % Write the xref table and trailer.
 
386
        % Write the xref table and trailer.
387
387
 
388
388
  /xref OFile fileposition def
389
389
  0 XRef ld_length 1 add pdfwritexref