123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- /PDFfile PDFname (r) file def
- /DSCfile DSCname (w) file def
- systemdict /.setsafe known { .setsafe } if
-
- /puts { DSCfile exch writestring } bind def
- /DSCstring 255 string def
- /MediaTypes 10 dict def
-
- GS_PDF_ProcSet begin
- pdfdict begin
- PDFfile
- pdfopen begin
- /FirstPage where { pop } { /FirstPage 1 def } ifelse
- /LastPage where { pop } { /LastPage pdfpagecount def } ifelse
-
-
- FirstPage 1 LastPage {
- pdfgetpage /MediaBox pget pop
- aload pop
- 3 -1 roll sub 3 1 roll exch sub exch
- 2 array astore
- aload 3 1 roll 10 string cvs exch 10 string cvs
- (x) 3 -1 roll concatstrings concatstrings cvn
- MediaTypes 3 1 roll exch put
- } for
-
-
- (
- Trailer /Info knownoget
- {
- dup /Title knownoget
- {
- (
- DSCfile exch write==
- }
- if
- /CreationDate knownoget
- {
- (
- DSCfile exch write==
- }
- if
- }
- if
-
- (
- MediaTypes {
- exch pop
- 1 index puts
- (y) puts dup 1 get DSCstring cvs puts
- (x) puts dup 0 get DSCstring cvs puts
- ( ) puts dup 0 get DSCstring cvs puts
- ( ) puts 1 get DSCstring cvs puts
- ( 70 white ()\n) puts
- pop (
- } forall
- pop
-
- (
- LastPage FirstPage sub 1 add DSCstring cvs puts
- (\n
- (
- (/Page null def\n/Page# 0 def\n/PDFSave null def\n) puts
- (/DSCPageCount 0 def\n) puts
- (/DoPDFPage {dup /Page# exch store pdfgetpage pdfshowpage } def\n) puts
- (GS_PDF_ProcSet begin\npdfdict begin\n) puts
- (
- (
- DSCfile PDFname write==only
- ( \(r\) file { DELAYSAFER { .setsafe } if } stopped pop\n) puts
- ( pdfopen begin\n) puts
- ( copy_trailer_attrs\n) puts
- (
-
- /.hasPageLabels false def
- Trailer /Root knownoget {
- /PageLabels knownoget {
- /PageLabels exch def
- /.pageCounter 1 def
- /.pageCounterType /D def
- /.pagePrefix () def
-
-
- /.ToLower {
- dup length 1 sub -1 0 {
- 1 index exch 2 copy get 2#00100000 or put
- } for
- } def
-
-
-
- /.CvAlpha {
- [ exch
- {
- dup 0 eq { pop exit } if
- dup 26 mod dup 0 eq { 26 add } if
- dup 64 add 3 1 roll sub 26 idiv
- } loop ]
- dup length dup string 3 1 roll
- dup -1 1 {
- 4 copy sub exch 4 -1 roll 1 sub get put
- } for pop pop
- } def
-
-
-
-
- /.CvRoman {
- dup DSCstring cvs
- exch 4000 lt {
- dup length
- [ [ () (I) (II) (III) (IV) (V) (VI) (VII) (VIII) (IX) ]
- [ () (X) (XX) (XXX) (XL) (L) (LX) (LXX) (LXXX) (XC) ]
- [ () (C) (CC) (CCC) (CD) (D) (DC) (DCC) (DCCC) (CM) ]
- [ () (M) (MM) (MMM) ] ]
- ()
- 2 index -1 1 {
- 2 index 1 index 1 sub get
- 5 index 5 index 4 -1 roll sub get
- 48 sub get concatstrings
- } for
- 4 1 roll pop pop pop
- } if
- } def
-
- /PageToString <<
- /D { DSCstring cvs }
- /R { .CvRoman }
- /r { .CvRoman .ToLower }
- /A { .CvAlpha }
- /a { .CvAlpha .ToLower }
- >> def
- /.hasPageLabels true def
- } if
- } if
-
-
- FirstPage 1 LastPage {
- (
-
- .hasPageLabels {
- dup 1 sub PageLabels exch numoget dup null ne {
-
- dup /S known { dup /S get } { null } ifelse
- /.pageCounterType exch def
-
- dup /P known { dup /P get } { () } ifelse
- /.pagePrefix exch def
-
- dup /St known { /St get } { pop 1 } ifelse
- /.pageCounter exch def
- } { pop } ifelse
-
-
- (\() .pagePrefix
- .pageCounterType //null ne dup {
- PageToString .pageCounterType known and
- } if {
- .pageCounter dup 0 gt {
- PageToString .pageCounterType get exec
- } {
- DSCstring cvs
- } ifelse
- } { () } ifelse
- (\)) concatstrings concatstrings concatstrings puts
-
- /.pageCounter .pageCounter 1 add def
- } {
- dup DSCstring cvs puts
- } ifelse
- ( ) puts
- dup DSCstring cvs puts
- (\n) puts
-
- dup pdfgetpage
- dup /MediaBox pget pop
- (
- aload pop 3 -1 roll sub DSCstring cvs puts
- (x) puts exch sub DSCstring cvs puts
- (\n) puts
- dup /CropBox pget {
- (
- {DSCfile exch write=only ( ) puts} forall
- (\n) puts
- } if
- /Rotate pget {
- (
- 90 div cvi 4 mod dup 0 lt {4 add} if
- [(Portrait) (Landscape) (UpsideDown) (Seascape)] exch get puts
- (\n) puts
- } if
-
- DSCfile exch DSCstring cvs writestring
- ( DoPDFPage\n) puts
- } for
- currentdict pdfclose
- end
- end
- end
-
- (
- (currentdict pdfclose\nend\nend\nend\n) puts
- (
-
- DSCfile closefile
- quit
|