Plan 9 from Bell Labs’s /usr/web/sources/patch/applied/page-pdf-crop/pdfprolog.ps.new

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


/Page null def
/Page# 0 def
/PDFSave null def
/DSCPageCount 0 def
/DoPDFPage {dup /Page# exch store pdfgetpage mypdfshowpage } def

/pdfshowpage_mysetpage {	% <pagedict> pdfshowpage_mysetpage <pagedict>
  dup /CropBox pget {
      boxrect
      2 array astore /PageSize exch 4 2 roll
      4 index /Rotate pget {
        dup 0 lt {360 add} if 90 idiv {exch neg} repeat
      } if
      exch neg exch 2 array astore /PageOffset exch
      << 5 1 roll >> setpagedevice
  } if
} bind def

/mypdfshowpage		% <pagedict> pdfshowpage -
 { dup /Page exch store
   pdfshowpage_init 
   pdfshowpage_setpage 
   pdfshowpage_mysetpage
   save /PDFSave exch store
   (before exec) VMDEBUG
     pdfshowpage_finish
   (after exec) VMDEBUG
   PDFSave restore
 } bind def

GS_PDF_ProcSet begin
pdfdict begin

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.