Perl/TkFAQ-11.7.如何把画布中的内容输出成PostScript文件?

王朝perl·作者佚名  2008-05-18
窄屏简体版  字體: |||超大  

原文:

11.7. How do I get a Canvas to output PostScript(c)?

Many thanks to Tom Oelke mailto:tpo9617@rit.edu for providing this question, answer & snippet of code:

The following section of code gets the postscript code for the section of canvas that's top-left corner is at $min_x, $min_y, and has a width and height equivalent to the displayed region. This ps code is then piped out to lpr to be printed.

my $ps = $canvas->postscript( '-x' => $min_x, '-y' => $min_y, -width => $canv->Width, -height => $canv->Height); open (PS, "| lpr"); # customize with -Pname e.g. print PS $ps; close (PS);

Whereas you would use something like: open (PS, ">file.ps"); # to output to a file print PS $ps; close (PS);

译文:

11.7. 如何把画布中的内容输出成PostScript文件?

非常感谢Tom Oelke提供了这个问题、答案和代码片断:

下面的这段代码将一个画布组件($canvas)的一部分输出成了一段postscript代码,此部分是以$min_x,$min_y坐标点为左上角,宽度和高度都等于画布显示的宽度和高度的区域中的内容。然后,这个PS的代码被直接输送给了lpr来进行打印。

my $ps = $canvas->postscript( '-x' => $min_x,

'-y' => $min_y,

-width => $canv->Width,

-height => $canv->Height);

open (PS, "| lpr"); # customize with -Pname e.g.

print PS $ps;

close (PS);

然而,你也许会希望保存成文件:

open (PS, ">file.ps"); # to output to a file

print PS $ps;

close (PS);

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航