简体   繁体   English

如何在 PS 文件中添加额外的 PostScript 命令

[英]How to add additional PostScript commands in PS files

My requirement is to add additional setpagedevice commands (eg: staple, punch, etc) like the below in a PS file.我的要求是在 PS 文件中添加其他 setpagedevice 命令(例如:装订、打孔等),如下所示。

**</Staple 3> setpagedevice**      % Start the first subset to be stapled
%Page 1
%Page 2
%Page 3
**</Staple 0> setpagedevice**     % End the first subset
**</Staple 3> setpagedevice**    % Start the second subset to be stapled
%Page 4
%Page 5
%Page 6
%Page 7
**</Staple 0> setpagedevice**     % End the second subset

I've to do this operation in a C# application.我必须在 C# 应用程序中执行此操作。 I would like to know whether there are any existing libraries that will allow me to insert setpagedevice commands in a PS file based on the specified page numbers.我想知道是否有任何现有的库允许我根据指定的页码在 PS 文件中插入 setpagedevice 命令。 For example, I should be able to insert a staple setpagedevice command after 10th page in a PS file.例如,我应该能够在 PS 文件的第 10 页之后插入一个 staple setpagedevice 命令。

@KenS 's comment has the answer which I was looking for. @KenS 的评论有我一直在寻找的答案。

If the program conforms to the Adobe Document Structure Convention then you could look for the %%Page: comment and modify the file that way.如果程序符合 Adobe 文档结构约定,那么您可以查找 %%Page: 注释并以这种方式修改文件。 Alternatively you could run the PostScript file as input to Ghostscript and use the ps2write device to produce a new PostScript program, you could probably use the PSPageOptions switch to include the specified program fragment on the specified pages或者,您可以运行 PostScript 文件作为 Ghostscript 的输入,并使用 ps2write 设备生成新的 PostScript 程序,您可以使用 PSPageOptions 开关将指定的程序片段包含在指定的页面上

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM