想要一个 postscript 文件,将原始 pdf 内容放在一个层上。原始 pdf 中的所有内容都放在一个层上。不知道如何将流放入 ocg... 我认为这也许是正确方向的开始。
% Command line to run this file:
% Navigate to folder or include full path
%windows cmd -> cd to folder
%gswin32c -o MySuperPDF.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress 170-0091.pdf PDFMarkLayers.txt
% Document Open Options
% Defines a catalogue
[ {Catalog}
% Catalogue entry that specifies that this is a Viewer Preference setting
<< /ViewerPreferences
% Catalogue entry that defines the open option and setting
<< /HideToolbar true
/HideMenuBar false
/NonFullScreenPageMode /UseOutlines >>
>> % End of catalogue entry
% Defines the pdfmark type as /PUT
/PUT pdfmark
% Set up the Page View
% Document displays without bookmarks or thumbnails
[ /PageMode /UseNone
%defines which page number (starting with 1) to start on
/Page 1
%Fits the page to the window
/View [/Fit]
/DOCVIEW pdfmark
% Modified from "Example: Putting a file’s contents into a text annotation"
/F (170-0091.pdf) (r) file def
% Create a object of type stream named 'mystream' for the data
[ /_objdef {mystream} /type /stream /OBJ pdfmark
% Inserts the value argument at the location index
[ {mystream} F /PUT pdfmark
% Create a key value that is an indirect references to the stream
[ /MyPrivateStreamData {mystream}
% Register layer and configure its default behavior
[{Catalog}
<< /OCProperties
<</OCGs [{ocg1} {ocg2}] /D
<</BaseState /ON /Order [{ocg1} {ocg2}] >>
>>
>> /PUT pdfmark
% Just create 2 layers
[ /_objdef {ocg1} /type /dict /OBJ pdfmark
[ {ocg1} <</Type/OCG /Name (My first layer)>> /PUT pdfmark
[ /_objdef {ocg2} /type /dict /OBJ pdfmark
[ {ocg2} <</Type/OCG /Name (My second layer)>> /PUT pdfmark