Copy link to clipboard
Copied
Hi all, Is there a standard or right way to inject multiple different PostScript streams into another one?
We are currently doing it in two different ways.
1) As we programmatically build the “outer” PostScript stream and add pages we may decide to read a complete new PostScript stream from the file system and include it into our own. This inner PostScript is a complete PostScript program on its own and typically is produced by MS Word printing to a file. We may do this several times before completing our “outer” PostScript. This method is used when we intend to send the PostScript to a physical printer device.
2) Same as above, however we use the “Run” command. We do this when converting from PS to PDF. The PostScript interpreter has access to the file system in this case.
We have been doing this for several years and while it has worked for the most part, I can’t help wondering if we should be doing something differently, perhaps somehow saving the state of the outer PostScript before injecting the inner PostScript, and then restoring that state after the inner PostScript. Any suggestions or comments would be helpful, thank you.
Copy link to clipboard
Copied
Encapsulating the sub-streams of PostScript with a "save" and "restore" pair would be "good practice", and although it appears that you aren't having any issues, this practice would allow you to input sub-streams that did not clean up after themselves without causing the primary stream to fail or give erroneous results.
Both methods you are currently using would benefit from using save/restore.