![Postscript 文件将所有内容放在一个层中](https://linux22.com/image/442707/Postscript%20%E6%96%87%E4%BB%B6%E5%B0%86%E6%89%80%E6%9C%89%E5%86%85%E5%AE%B9%E6%94%BE%E5%9C%A8%E4%B8%80%E4%B8%AA%E5%B1%82%E4%B8%AD.png)
想要一个 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