plan9port/src/cmd/page/pdfprolog.c
Fazlul Shahriar 01a29ffe9d page: fix pdf prolog for ghostscript >= 9.27 (#296)
Ghostscript 9.27 removed GS_PDF_ProcSet and pdfdict due to a security
issue (see https://security-tracker.debian.org/tracker/CVE-2019-3839).

This fix was contributed by @onyxperidot (see #279).

Fixes #279
2019-12-08 20:20:22 -05:00

20 lines
572 B
C

"/Page null def\n"
"/Page# 0 def\n"
"/PDFSave null def\n"
"/DSCPageCount 0 def\n"
"/DoPDFPage {dup /Page# exch store pdfgetpage pdfshowpage } def\n"
"\n"
"/pdfshowpage_mysetpage { % <pagedict> pdfshowpage_mysetpage <pagedict>\n"
" dup /CropBox pget {\n"
" boxrect\n"
" 2 array astore /PageSize exch 4 2 roll\n"
" 4 index /Rotate pget {\n"
" dup 0 lt {360 add} if 90 idiv {exch neg} repeat\n"
" } if\n"
" exch neg exch 2 array astore /PageOffset exch\n"
" << 5 1 roll >> setpagedevice\n"
" } if\n"
"} bind def\n"
"\n"
"runpdfbegin\n"