0

Would like a postscript file that will place original pdf content onto a layer. Everything in the original pdf goes on a layer. Don't know how to place the stream into the ocg... This is the start of what I think might be the right direction.

% 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
3
  • Not sure if this counts as a TeX question...? Commented Nov 27, 2021 at 5:06
  • There is no way to embed PDF into PostScript without converting it to EPS beforehand. Commented Nov 29, 2021 at 10:56
  • This line [ /MyPrivateStreamData {mystream} looks like it's missing /PUT pdfmark or something else. As is, it's just leaving stuff on the stack. Commented Dec 3, 2021 at 22:47

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.