后记:知道我需要什么,但不知道如何去做
我们通过将 ps 和 eps 文件粘合在一起并叠加数据来打印客户表格来创建打印文件......然后将这些文件发送到打印机。
由于打印机发生了变化,我们必须调整脚本。我们现在正在研究 XEROX 打印机,它们是非常不同的动物。
我们已经建立了一个程序来设置打印托盘,它需要更改。Xerox
/stray
{
/Pagedv exch def
#ifdef :OK431
/DriverOps /ProcSet 2 copy resourcestatus{pop pop findresource Pagedv exch /setinputslot get exec}{pop pop}ifelse globaldict /OK@_CustTray 0 put
#elif :O4600
/PageSub Pagedv 1 sub def currentpagedevice /InputAttributes get PageSub known{ Pagedv statusdict /setpapertray 2 copy known{ get {exec}stopped {pop}{globaldict /OK@_CustTray PageSub put}ifelse (<<) cvx exec /Policies (<<) cvx exec /PageSize 7 (>>) cvx
exec (>>) cvx exec setpagedevice }{pop pop pop}ifelse }if
#elif :HPPRO
currentpagedevice /InputAttributes get Pagedv <</MediaPosition Pagedv >> setpagedevice
#else
<<currentpagedevice /InputAttributes get Pagedv get {}forall /InputAttributes << /Priority [Pagedv] >> >> setpagedevice
不不根据 PPD 使用数字,它使用字符串(即 Tray-1)
Pagedv 是一个整数,因此我需要在将其返回给调用者之前将文字“Tray-”附加(连接)到它上面
> #elif :XRX
> currentpagedevice /InputAttributes get Pagedv << (Tray-Pagedv) xerox$MediaInputTray >> setpagedevice
我有一个连接程序我只是不确定在这种情况下如何使用它。
/concatstrings % (a) (b) -> (ab)
{ exch dup length
2 index length add string
dup dup 4 2 roll copy length
4 -1 roll putinterval
} bind def
We create printfiles by gluing ps and eps files together and overlay data to print customer forms.. and then send those files to the printer.
As printers have changed we have had to adjust the scripts.. We are now looking at XEROX printers and they are very different animals..
We've built a procedure that sets the tray to print from and it needs a change..
/stray
{
/Pagedv exch def
#ifdef :OK431
/DriverOps /ProcSet 2 copy resourcestatus{pop pop findresource Pagedv exch /setinputslot get exec}{pop pop}ifelse globaldict /OK@_CustTray 0 put
#elif :O4600
/PageSub Pagedv 1 sub def currentpagedevice /InputAttributes get PageSub known{ Pagedv statusdict /setpapertray 2 copy known{ get {exec}stopped {pop}{globaldict /OK@_CustTray PageSub put}ifelse (<<) cvx exec /Policies (<<) cvx exec /PageSize 7 (>>) cvx
exec (>>) cvx exec setpagedevice }{pop pop pop}ifelse }if
#elif :HPPRO
currentpagedevice /InputAttributes get Pagedv <</MediaPosition Pagedv >> setpagedevice
#else
<<currentpagedevice /InputAttributes get Pagedv get {}forall /InputAttributes << /Priority [Pagedv] >> >> setpagedevice
Xerox doesn't use a number according to the PPD it uses a string (ie Tray-1)
Pagedv is an integer so I need to append (concatenate) the literal "Tray-" onto it before we return it to the caller
> #elif :XRX
> currentpagedevice /InputAttributes get Pagedv << (Tray-Pagedv) xerox$MediaInputTray >> setpagedevice
I have a concatenate procedure I'm just not sure how to use it in this case.
/concatstrings % (a) (b) -> (ab)
{ exch dup length
2 index length add string
dup dup 4 2 roll copy length
4 -1 roll putinterval
} bind def
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你想连接两个字符串来生成一个新字符串,并且你拥有的是一个字符串和一个整数(Pagedv),那么你需要做的第一件事就是将整数转换为字符串。
为此,您需要一个足够大的空字符串来保存结果,然后将其和整数传递给 cvs 运算符。因此,PostScript 片段如下所示:
因此,如果 Pagedv 的值为 1,那么您现在将拥有长度为 1 的 PostScript 字符串
(1)
。如果您已经定义了 /concatstrings 函数,并且确定它可用(即在字典堆栈上的字典中并且不会被同名的另一个函数隐藏),那么您只需执行以下操作:
这将产生一个字符串
(Tray-1).您可能会发现避免调用函数并在本地一次性完成整个事情会更简单。
Well if you want to concatenate two strings to produce a new string, and what you have is a string and an integer (Pagedv), then the first thing you need to do is turn the integer into a string.
To do that you'll need an empty string big enough to hold the result, and then pass that and the integer to the
cvs
operator. So a PostScript fragment like this:So if you had a value of 1 for Pagedv then you would now have a PostScript string
(1)
of length 1.If you've already defined your /concatstrings function, and are certain it will be available (ie in a dictionary on the dictionary stack and not concealed by another function of the same name) then you would just do:
Which would result in a string of
(Tray-1)
. You might find it simpler to avoid calling a function and just do the whole thing at once locally.