工作的原因需要从基于RedHat Linux的ERP打印输出中文和日文text文件报表,问题是服务器在美国,那边的系统管理员不希望因为这个原因修改系统配置。于是有两个选择,一个是使用带硬字库的打印机来自动识别系统输出的文本文件;另外一种是使用外挂的程序利用软字库在文件输出到打印机前先对文本文件进行处理,然后输出到打印机。在后一种方式下,我看了比较有名的一个程序CNPRINT。可惜的是它的功能过于繁杂,使得真正用于东亚文本转换PS文档的功能不是很完美。觉得如果有一个程序象ENSCRIPT那样简单,但是支持软字库就完美了。无奈之下,只能借鉴CNPRINT的源码,重写了自己的代码。这个程序最终没能用于公司的ERP系统,因为硬字库方案最终胜出。这样匆匆忙了两个礼拜的代码,只能作为自己的兴趣和爱好独自维护了。下面是程序的自带帮助。
引用

Chinese Japanese Korean to Postscript (WINNT) V0.00 beta

USAGE:    cjk2ps [-options] [-SWITCHES]

Options:
       [-cp gb2312|gbk|big5|jis|shiftjis]:
            Input code page(default codepage is gb2312).

       [-i input_file]:
            Input file name.(default output is stdin)

       [-o output_file]:
            Output ps filename.(default output is stdout)

       [-ln ##]:
            Lines every page.(default is 66 line/page)

       [-ll ##]:
            Character num every line.(default is determined by the paper size)

       [-lm ##.##]:
            Left margin.(default is 1.5 cm)

       [-rm ##.##]:
            Right margin.(default is 1.5 cm)

       [-tm ##.##]:
            Top margin.(default is determin by paper size & lines/page)

       [-bm ##.##]:
            Bottom margin.(default is determin by pape size & lines/page)

       [-ps A4|A3|Letter|Legal]:
            Paper size.(default is A4)

       [-dm cm|in]:
            Unit of measure.(default is cm)

       [-co ##]:
            Number of copies.(default is 1)

       [-ratio ##.##]:
            Ratio of font size,minus number for shrinking.(default is 1)

       [-ini ini_file]:
            ini file name.(default is cjk2ps.ini in same directory of program)

       [-dpi #####]:
            Output ps file dpi.(default dpi is 600)
Switches:
       [-S ] :   Silent mode on
       [-D ] :   Debug mode on
       [-H ] :   Help
       [-L ] :   Landsacpe output(default is portrait)
       [-LN] :   Print line number
       [-CN] :   Print column number
       [-PN] :   Print page number


Source Code of CJK2PS.C and TTF.C
Chinese and Japanese code conversion map.
Chinese and Japanese True Type Font

最后编辑: Robin Hoo 编辑于2006/05/09 15:39

文章来自: 本站原创
0 comment(s)
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]
               

验证码 不区分大小写