Import sources from 2011-03-30 iso image - sys/lib
This commit is contained in:
parent
b41b903422
commit
e463eb4036
1144 changed files with 388460 additions and 0 deletions
59
sys/lib/ghostscript/pdfeof.ps
Executable file
59
sys/lib/ghostscript/pdfeof.ps
Executable file
|
@ -0,0 +1,59 @@
|
|||
% Copyright (C) 2000 Aladdin Enterprises. All rights reserved.
|
||||
%
|
||||
% This file is part of Aladdin Ghostscript.
|
||||
%
|
||||
% Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
|
||||
% or distributor accepts any responsibility for the consequences of using it,
|
||||
% or for whether it serves any particular purpose or works at all, unless he
|
||||
% or she says so in writing. Refer to the Aladdin Ghostscript Free Public
|
||||
% License (the "License") for full details.
|
||||
%
|
||||
% Every copy of Aladdin Ghostscript must include a copy of the License,
|
||||
% normally in a plain ASCII text file named PUBLIC. The License grants you
|
||||
% the right to copy, modify and redistribute Aladdin Ghostscript, but only
|
||||
% under certain conditions described in the License. Among other things, the
|
||||
% License requires that the copyright notice and this notice be preserved on
|
||||
% all copies.
|
||||
|
||||
% $Id: pdfeof.ps,v 1.1 2000/03/09 08:40:40 lpd Exp $
|
||||
% Patch to allow garbage on the end of PDF files.
|
||||
|
||||
.currentglobal true .setglobal
|
||||
pdfdict begin
|
||||
|
||||
% Skip backward over the %%EOF at the end of the PDF file.
|
||||
% We put this in a separate procedure so we can easily offer the option
|
||||
% of accepting garbage after the %%EOF, which the PDF specification
|
||||
% unambiguously forbids but which some applications (including, apparently,
|
||||
% Acrobat Distiller on the Macintosh) produce, and of accepting the
|
||||
% xref position on the same line as startxref.
|
||||
/findxref { % - findxref <xrefpos>
|
||||
PDFfile dup dup 0 setfileposition bytesavailable
|
||||
dup /PDFfilelen exch def
|
||||
% Find the last %%EOF string (within 2048 bytes)
|
||||
2048 sub PDFoffset .max
|
||||
2 copy setfileposition
|
||||
PDFfilelen exch sub string 1 index exch readstring pop {
|
||||
(\015%%EO) search { % Adobe can handle truncated key string
|
||||
pop pop % if found, keep searching 'post' string
|
||||
} {
|
||||
(\012%%EO) search
|
||||
{ pop pop } { exit } ifelse % exit if neither string found
|
||||
} ifelse
|
||||
} loop
|
||||
PDFfilelen exch length sub 4 sub PDFoffset .max setfileposition
|
||||
% Now read the startxref and xref start position.
|
||||
prevline token not { null } if dup type /integertype eq {
|
||||
exch pop cvi % xref start position
|
||||
exch PDFfile exch setfileposition
|
||||
prevline (startxref) linene { findxreferror } if
|
||||
pop
|
||||
} { % else, this file has 'startxref #####' format
|
||||
(startxref) ne { findxreferror } if
|
||||
cvi % xref start position
|
||||
exch PDFfile exch setfileposition
|
||||
} ifelse
|
||||
} bind def
|
||||
|
||||
end % pdfdict
|
||||
.setglobal
|
Loading…
Add table
Add a link
Reference in a new issue