EBS 打印机设置——PASTA

来源:互联网 发布:郑州美好电子淘宝店 编辑:程序博客网 时间:2024/04/29 13:40

按照Oracle的说法,PASTA解决的是通过CM直接打印到打印机的问题。换句话说如果不想通过CM直接打印到打印机,可以不使用PASTA;这个和PS中文输出没有关系。

确实如此,从执行过程看,我觉得完全可以这样理解:PASTA是操作系统lp命令的扩展!


PASTA的可执行程序是FNDPSTAX,具体参数请看PASTA User Guide 3.0(目前最高版本)。这里提供一个例子:
FNDPSTAX -fSCFTEST.ps -o1.ps -np
或者FNDPSTAX -fSCFTEST.txt -o1.ps -np

或者FNDPSTAX -fSCFTEST.pdf -o1.ps -np

这3个例子也是PASTA目前支持的文件类型
-f是输入文件名
-o是输出文件名
-np是说不用打印
-F是配置文件,这里没用,默认是pasta.cfg

注意,和上面的IX虽然用的是同一个配置文件,但不要搞混淆了。PASTA也有IX
Printing功能,到底是用6i的还是自己的就无所谓了。
前面讲过,FNDPSTAX本身不用IX_PRINTING环境变量。

实际上PASTA的功能是把CM输出的.out文件,按照pasta.cfg(实际上可能用其他文件)的指示做格式文件转换,然后调用操作系统打印命令打印到打印机。操作系统打
印由配置文件指定,如:
% for UNIX platform
printCommand=lp -c -d{printername}
% for Windows platform
ntPrintCommand=print /D:{printername}


PASTA格式转换说明
打印机不认PDF文件,所以在调用操作系统打印命令之前需要转换格式,PASTA就是处理这种情况的解决方案之一。
从目前看,PASTA支持下面几种格式的输入文件:PDF,PS,ASCII。

当然PASTA是自动检测文件类型的,和文件扩展名没有关系,实际CM传给FNDPSTAX的都是.out文件。
转换逻辑

PS文件:不转,直接送给打印机
ASCII:看配置文件的outputFormat参数,该参数默认是ps,所以会转成PS格式,这个时候就要用配置文件里面指定的字体了;转换完毕,再送给打印机。注意这里的PS
文件和我们请求的PS输出是两码事!

PDF:PASTA本身没有能力处理,需要送给其他外部程序处理,这个由preprocess参数决定,如:
% You can get a list of output devices available in Ghostscript
% at:
% http://www.gnu.org/software/ghostscript/devices.html
; preprocess=gs -q -dNOPAUSE -dBATCH -sDEVICE=pxlmono -sOutputFile={outfile}
{infile}
……
; preprocess=ps2pdf {infile} {outfile}

转换完毕,再送给打印机。
这里的结果文件是临时文件,用完默认就删除了,不影响我们的.out文件。
我在Windows平台用的是Xpdf,测试OK。


PASTA配置文件说明:
直接看pasta.cfg文件的说明即可。这里提一下重点:[DEFAULT]区域的Font.Default.Plain和Font.Default.Bold 设的是默认字体。

语言区域如[AMERICAN]或者[SIMPLIFIED CHINESE](当然可以设置在一起用逗号隔开,还可以设置Territory)设置的是根据用户当前NLS_LANG做判断选择的字体。
字体ADUOSC.ttf(普通)和ADUOSCB.ttf(粗体)支持中文。所以有人干脆把它作为[DEFAULT]设置以解决中文问题,这个不是地道的做法。


PASTA打印机设置说明
看系统管理员文档即可。很简单,向系统注册支持Postscript的操作系统打印机(名字
要一样),类型选择--PASTA Universal Printer Type;当然也可以参照这个自定义
了。



PASTA配置文件:

路径:$FND_TOP/$APPLRSC/pasta.cfg

/* $Header: pasta.cfg 120.0 2005/05/07 16:44:37 appldev noship $ */

%%
%% pasta.cfg -- Pasta configuration file
%%
% Hisory
%
% Initial - Copied frommmm pasta.cfg in Pasta 2.5.1
%           Removed multiple font support, which only works for IX Library
. ——只有IX Libary支持多种字体
%


% This is the main Pasta configuration file.
%
% If this is the first time you have modified this file, please read the
% notes at the end of this file first.
%
%%%% ================= Overview ======================================= %%%%
% Pasta is a product that is part of the E-Business Suite's Application
% Object Library (FND). It is provided as an executable named FNDPSTAX
% and enables you to print a text report that contains any characters
% from any language.
%
% You can use the same configuration file for both Pasta and IX 
% Library, or you can use separate ones.
%
% Any line that starts with a % (percent) or a ; (semi-colon) is a
% comment and is ignored. In this sample file we are using a % for
% commentary and a ; for options that you may want to enable.——以%开头的是解释,以 ;开头的是可能设置的选项
%
% Any variable that starts with a < (less-than) and ends with a >
% (greater-than) in fontpath, boldfontpath, errorlogfile and outfile
% parameters will be transalted into an environment variable. You can
% specify any environment variable. Pasta will replace the environment
% variable with the actual value at runtime.
%
% You can use either a / (slash) or a \ (backslash) as the delimiter in
% a file path, regardless of the platform. Pasta will use an
% appropriate delimiter automatically according to platform.
%
% The configuration options are grouped into sections. A section
% starts with a [ (left square bracket) and ends with a ] (right square
% bracket). Section names are case insensitive. The [DEFAULT] section
% is mandatory. The language and territory sections are optional. If you
% want to override the options in the [DEFAULT] section according to
% languages and territories, you can add multiple language and territory
% sections. Each language section is specified by [{NLS_LANGUAGE}] where
% {NLS_LANGUAGE} is the Oracle language name. Each territory section is
% specified by [_{NLS_TERRITORY}] where {NLS_TERRITORY} is Oracle
% territory name. Also, you can specify both {NLS_LANGUAGE} and
% {NLS_TERRITORY} at the same time as [{NLS_LANGUAGE}_{NLS_TERRITORY}].
% One section name can contain multiple languages and/or territories
% separated by commas.
%
%% The following notes apply only to Pasta, not to the IX Library.
%
% If you have multiple printers registered and you need a specific setup
% for each printer, it is very easy to have a specific configuration file
% for each printer. This is an example for supporting a PCL printer.
%
%  1. Copy $FND_TOP/resource/pasta.cfg to
%     $FND_TOP/resource/pasta_<yourprinter>.cfg where <yourprinter>
%     will be the printer name you define on the operating system and
%     in the E-Business Suite (both should be the same name).
%
%  2. Edit the configuration file to meet your requirement.
%     For example, if you need to print in PCL then uncomment the
%     preprocess option for PCL printing and make necessary changes
%     for the parameters of Ghostscript if needed.
%     Regarding Ghostscript, please refer to http://www.ghostscipt.com.
%
%  3. PASTA will try to read $FND_TOP/resource/pasta_<yourprinter>.cfg
%     first and if the file is not found then will try to read
%     $FND_TOP/resource/pasta.cfg.
%
% The default name of the configuration file is "pasta.cfg". You can
% override it by using the '-F' (configuration file) command line option.
% For example, if you specify "-Fpcl.cfg" in the command line, Pasta
% will search for the file named "pcl_<your printer>.cfg" first and then
% search for "pcl.cfg".
%
% Parameters indicated as "IX Library compatible" work for IX Library too.
% All options affect to character mode reports.
%
% Please note that most of the options will not affect to pass through
% mode such a case that input file format is PostScript or PDF printing.
% The option that will take affect are: 
% printCommand, printCommandOption, ntPrintCommandOption and preprocess




%%%% ================= Default settings ============================ %%%%
%% The options in this default section can be overridden by the options
%% in the language and territory sections below.


[DEFAULT]


        %% ============== Output Format ============================ %%
        % Output Format [ps|text.<charset|auto>]
        %
        % Currently, Pasta supports two output formats: Postscript and
        % text. If you have a Postscript Level 2 (or higher) printer,
        % please set this option to "ps". If the input is a text file,

        % Pasta will convert it to a Postscript file. If the input is
        % already a Postscript file, Pasta will send it to a printer as
        % is. Whether a file is Text or PS is automatically sensed on
        % input.
        %
        % If you don't have a Postscript printer and want to send a
        % text file to your printer, please set this option to "text".
        % You can specify the output character set by the Oracle
        % character set name (e.g. text.WE8ISO8859P1). You can use
        % "auto" as the output character set (e.g. text.auto). In that
        % case, Pasta will convert the data from the original character
        % set to an appropriate one according to the NLS_LANGUAGE setting.
        %
        % In the case of text output, only the thai_space_compensation
        % and preprocess options are effective. Other options are ignored.
        %
        % If you set this option to "text" and want to send printer-
        % specific escape sequences to your printer with text, you
        % must keep the escape sequence settings in "Initialization"
        % and "Reset" in the printer driver.
        outputFormat=ps


        %% ============== Preprocessing Command ==================== %%
        % Pasta can use a preprocessing command to invoke any executable
        % that supports an input file and an output file (a filter program).
        % You can use redirection. Pasta will invoke the filter program
        % to preprocess the Pasta output before passing it to the printing
        % command. By using the preprocess option, you can generate output
        % formats other than the formats Pasta currently supports. For
        % example, you can generate PCL output.


        % You can use {infile} and {outfile} in this option.
        % {infile} is the output file generated by Pasta. You can use
        % it as input for the preprocessing command. It is a temporary
        % file and will be deleted after being passed to the
        % preprocessing command. {outfile} is the output file generated
        % by the preprocessing command. Pasta names it temporarily and
        % it will be deleted after being passed to the printing command.
        % If you want to keep it, you can name it by using the '-o'
        % command line option. Pasta will copy {outfile} to the file you
        % specify.


        % Preprocess for PCL printing
        % This is an example for PCL printing. In this example, "gs" is
        % Ghostscript and "pxlmono" is a device used with HP black and
        % white PCL XL printers (LaserJet 5 and 6 family).
        % Ghostscript is a tool that can convert a Postscript file to
        % a PCL file.
        % You can get the latest version of Ghostscript at:
        % www.ghostscript.com.
        %
        % You can get a list of output devices available in Ghostscript
        % at:
        % http://www.gnu.org/software/ghostscript/devices.html
        ; preprocess=gs -q -dNOPAUSE -dBATCH -sDEVICE=pxlmono -sOutputFile={outfile} {infile}


        % Preprocess for PDF output
        % This is an example for PDF output. ps2pdf is a shell script
        % bundled with Ghostscript. ps2pdf can convert a Postscript
        % file to a PDF file. In most cases, you cannot send a PDF
        % file to the printer command because the printer command
        % cannot understand PDF. Set the noPrint option to "y" or use
        % the '-np' (no print) command line option if you do not want
        % to have Pasta send the PDF file to a printer. Use the outFile
        % option or the '-o' (output file name) command line option to
        % store the output file wherever you like. You can use {inputfile}
        % in the outFile option. Pasta will replace it with the actual
        % input file name (without the path) specified by the '-f'
        % (input file) command line option.
        ; preprocess=ps2pdf {infile} {outfile}
        ; noPrint=y
        ; outFile=<APPLTMP>/{inputfile}.pdf


        %% ============== Paper Size (in inches) =================== %%
        % You can specify the paper (page) size in inches. Pagewidth
        % specifies width and pageheight specifies height. If you want
        % to use a different paper size for a particular language or
        % territory, please override this value in the language and/or
        % territory sections.


        % [A4]
        pagewidth=8.27
        pageheight=11.69


        % [Letter]
        % If you want to use Letter as the default paper size, comment
        % the A4 settings above and uncomment the following lines:
        ; pagewidth=8.5
        ; pageheight=11


        %% ============== Space Size  ============================== %%
        % You can increase the space between characters by increasing
        % the value of widthScaleRate and between lines by increasing
        % the value of heightScaleRate.
        widthScaleRate=1.0
        heightScaleRate=1.0 


        %% ============== Margins (in inches) ====================== %%
        % These settings should be changed to suitable values for your
        % printer.
        topMargin=0.25
        leftMargin=0.25
        rightMargin=0.25
        bottomMargin=0.25


        %% ============== Tab Size (in spaces) ===================== %%
        % Pasta replaces a tab with a specified number of spaces. You
        % can alter the number of spaces using this option.
        tabsize=8


        %% ============== Font Size (in points) ==================== %%
        % This value affects all of the fonts you use in your reports.
        % You can specify any number (e.g. 10.5).
        fontsize=9


        %% ============== Font Name ================================ %%
        % You can use any TrueType fonts on your middle tier server.
        % If you specify a TrueType font, Pasta will subset and embed
        % the font in the Postscript output file and send it to your
        % Postscript printer. Your printer does not need to have any
        % fonts installed. Oracle provides Andale fonts (ADUO*.ttf)
        % for printing. Also, if your printer has a font installed that
        % is suitable for the language of your report, you can utilize
        % the printer font.
        %
        % The form of this option is:
        % Font.<Face>.<Style>=<TrueType font file name>
        % or
        % Font.<Face>.<Style>=printer:<Printer font name>
        %
        % The <Face> must be either "Default" for Pasta.
        %
        % The <Style> must be either "Plain" or "Bold".
        % 
        % Font options are IX Library compatible.
        Font.Default.Plain=<FND_TOP>/<APPLRSC>/ADUO.ttf
        Font.Default.Bold=<FND_TOP>/<APPLRSC>/ADUOB.ttf


        % Uncomment the following if you want to use printer fonts as a
        % default. All printers have the Courier font installed by default.
        % Courier has glyphs for Western European characters. 
        ; Font.Default.Plain        = printer:Courier
        ; Font.Default.Bold         = printer:Courier-Bold


        %% ============== Printing Command ========================= %%
        % You can specify the printing command and options you want
        % to use to print your report. Pasta will pass the final output
        % to this command. {printername} will be replaced by the
        % actual printer name passed through the command line option
        % (-pn), so in most cases you don't have to change these
        % options.


        % for UNIX platform
        printCommand=lp -c -d{printername}


        % for Windows platform
        ntPrintCommand=print /D:{printername}


        %% ============== Printing Options ========================= %%
%
        % Embed number of copies [y|n]
        %
        % You can embed the number of copies to be printed in a
        % Postscript file. However, some other printers do not support
        % the command. In that case, please set this option to "n".
        % Pasta will send the report multiple times up to the number of
        % copies. By embedding the number of copies, you can eliminate
        % the header page normally printed between reports.
        embednumcopies=y


        % Collate [y|n]
        %
        % If you set "embednumcopies" to "y" above, you can choose to
        % have the copies collated (e.g. 123123) or uncollated
        % (e.g. 112233) by setting the "copysort" option. If you set
        % "embednumcopies" to "n", the order is always 123123.
        % For example, if you want to print two copies of a report
        % that has 3 pages, the output will be:
        %
        %            | embednumcopies
        %            | y         n
        % ------------------------------
        % copysort y | H123123   H123H123
        % copysort n | H112233   H123H123
        %
        % where "H" stands for a header and "123" stands for 1st page,
        % 2nd page and 3rd page.
        copysort=y


        % Duplex printing [y|n|default]
        %
        % You can specify duplex or not. "default" means that it depends
        % on the printer-side setting.
        duplex=default


        %% ============== BiDi Specific Options ==================== %%
        % The following options work only for Bi-Directionallanguages
        % such as Arabic or Hebrew.


        % Global direction [ltr|rtl|default]
        %
        % ltr: Left-To-Right
        % rtl: Right-To-Left
        % default: It depends on NLS_LANGUAGE. If NLS_LANGUAGE is
        %          Arabic or Hebrew, it is rtl. Otherwise, it is ltr.
%
        % <IX Library compatible>
        direction=default


        % Do string layout [y|n]
        % <IX Library compatible>
        dolayout=y


        % Do Arabic shaping [y|n]
        % <IX Library compatible>
        doshaping=y


        % numerals [arabic|hindi|context]
        %
        % arabic: To always use Arabic numerals
        % hindi: To always use Hindi numerals
        % context: To use Arabic or Hindi depending on the context
        % <IX Library compatible>
        numerals=context


        % Bidi layouting algorithm [oracle|unicode]
        % 
        % If you set this option to "unicode", Pasta follows the
        % Unicode BiDi algorithm. For information about the Unicode BiDi
        % algorithm, please refer to the following site.
        % http://www.unicode.org/unicode/reports/tr9/index.html
        %
        % For backward compatibility, Pasta still supports Oracle's
        % original algorithm. If you want to use it, please set
        % this option to "oracle".
        % <IX Library compatible>
        bidi_algorithm=unicode


        %% ============== Thai Specific Options ==================== %%
        % Space compensation for Thai [y|n]
        %
        % In the Thai language, some characters are combined into one
        % glyph. If thai_space_compensation is set to "y", Pasta will
        % align your report by adding spaces at the end of any string
        % that includes combined characters. This option works only for
        % Thai characters. Pasta can automatically detect Thai characters,
        % so it is safe to set this option to "y" for languages other
        % than Thai. However, it may affect performance because Pasta
        % checks whether space compensation is necessary or not for all
        % characters. In this configuration file, this option is set to
        % "y" only in the Thai section below, which overrides the setting
        % here.
        thai_space_compensation=n


        %% ============== Error Log File =========================== %%
        % This tells Pasta to create a log file. The default error
        % output is stderr.
        ;errorlogfile=pasta.log




%%%% ================= Language Specific Settings ================== %%%%
%%%% Each language section is specified by [{NLS_LANGUAGE}] where
%%%% {NLS_LANGUAGE} is the Oracle language name.
%%%% One section name can contain multiple languages separated by 
%%%% commas.


%% For Western European (Latin-1) languages
[AMERICAN,CATALAN,GERMAN,DANISH,SPANISH,LATIN AMERICAN SPANISH,FRENCH,CANADIAN FRENCH,ENGLISH,ITALIAN,ICELANDIC,NORWEGIAN,DUTCH,PORTUGUESE,BRAZILIAN PORTUGUESE,SWEDISH,FINNISH]


        Font.Default.Plain        = printer:Courier
        Font.Default.Bold         = printer:Courier-Bold


%% For Simplified Chinese
[SIMPLIFIED CHINESE]


        Font.Default.Plain=<FND_TOP>/<APPLRSC>/ADUOSC.ttf
        Font.Default.Bold=<FND_TOP>/<APPLRSC>/ADUOSCB.ttf


%% For Traditional Chinese
[TRADITIONAL CHINESE]


        Font.Default.Plain=<FND_TOP>/<APPLRSC>/ADUOTC.ttf
        Font.Default.Bold=<FND_TOP>/<APPLRSC>/ADUOTCB.ttf


%% For Japanese
[JAPANESE]


        Font.Default.Plain=<FND_TOP>/<APPLRSC>/ADUOJ.ttf
        Font.Default.Bold=<FND_TOP>/<APPLRSC>/ADUOJB.ttf


%% For Korean
[KOREAN]


        Font.Default.Plain=<FND_TOP>/<APPLRSC>/ADUOK.ttf
        Font.Default.Bold=<FND_TOP>/<APPLRSC>/ADUOKB.ttf


%% For Thai
[THAI]


        thai_space_compensation=y


        % If you need text output for Thai, please uncomment the 
        % following line.
        ; outputFormat=text.TH8TISASCII




%%%% ================= Territory Specific Settings ================= %%%%
%%%% Each territory section is specified by [_{NLS_TERRITORY}] where
%%%% {NLS_TERRITORY} is the Oracle territory name.
%%%% One section name can contain multiple territories separated by 
%%%% commas.


%% For America and Canada regions
[_AMERICA,_CANADA]


        % [Letter]
        pagewidth=8.5
        pageheight=11












0 0
原创粉丝点击