Bom dia pessoal...

Aí vai o código, estou programando a parte de gerar carnês, dos
parcelamentos do sistema, e tb está funcionando ok.

Abraços... ;)

Componente SWC:
http://e-jovemce.sdserver8.com/offline/edinho/DotPrinter.swc

---------------------------------------- Application

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; xmlns:kernel="*"
    backgroundColor="#ffffff"
    backgroundGradientAlphas="[1.0, 1.0]"
backgroundGradientColors="[#204D6D, #204D6D]">
    <mx:Script>
    <![CDATA[
        private function init():void
        {
            var print:FormCliente = new FormCliente();
            print.setStyle("backgroundColor", getStyle("backgroundColor"));
            preview.doAction(print);
        }
    ]]>
    </mx:Script>
    <kernel:KernelPrint id="preview" x="10" y="10"
creationComplete="init();">
    </kernel:KernelPrint>
</mx:Application>

---------------------------------------- FormCliente

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas
    xmlns:mx="http://www.adobe.com/2006/mxml";
    height="815" width="560"
    backgroundColor="#FFFFFF"
    color="#000000"
    horizontalScrollPolicy="off"
    verticalScrollPolicy="off"
 fontSize="9">

    <mx:Label x="12" y="67" text="Nome / Razão Social:"/>
    <mx:Label x="54" y="88" text="Nascimento:"/>
    <mx:Label x="91" y="150" text="CPF:"/>
    <mx:Label x="85" y="108" text="CNPJ:"/>
    <mx:Label x="252" y="129" text="Endereço:"/>
    <mx:Label x="264" y="150" text="Cidade:"/>
    <mx:Label x="267" y="172" text="Bairro:"/>
    <mx:Label x="344" y="60" text="Código do cliente:" fontWeight="bold"/>
    <mx:Label x="94" y="172" text="RG:"/>
    <mx:Label x="99" y="129" text="IE:"/>
    <mx:Label x="264" y="88" text="Celular:"/>
    <mx:Label x="279" y="108" text="Fax:"/>
    <mx:Label x="10" y="10" text="Relatório" fontSize="13"
fontWeight="bold"/>
    <mx:Label text="Dados Pessoais:" fontWeight="bold" x="10" y="41"
fontSize="11"/>
    <mx:Label x="125" y="67" text="nome" id="nome"/>
    <mx:Label x="125" y="88" text="nascimento" id="nascimento"/>
    <mx:Label x="125" y="108" text="cnpj" id="cnpj"/>
    <mx:Label x="125" y="129" text="ie" id="ie"/>
    <mx:Label x="125" y="149.95" text="cpf" id="cpf"/>
    <mx:Label x="125" y="172" text="rg" id="rg"/>
    <mx:Label x="317" y="88" text="celular" id="celular"/>
    <mx:Label x="317" y="108" text="fax" id="fax"/>
    <mx:Label x="317" y="129" text="endereco" id="endereco"/>
    <mx:Label x="317" y="150" text="cidade" id="cidade"/>
    <mx:Label x="317" y="172" text="bairro" id="bairro"/>
    <mx:Label x="443" y="60" text="codigo" id="codigo" fontWeight="bold"
fontSize="10"/>
</mx:Canvas>

---------------------------------------- KernelPrint

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow
    xmlns="*"
    xmlns:mx="http://www.adobe.com/2006/mxml";
    width="690"
    backgroundColor="#FFFFFF"
    roundedBottomCorners="true"
    paddingBottom="0" paddingLeft="0" paddingRight="0" paddingTop="0"
    height="502" title="Visualiza Impressão">

    <mx:Script>
        <![CDATA[
            import com.kernel.printers.EpsonPrint;
            import mx.printing.FlexPrintJob;

            private var thePrintView:*;
            private var originalWidthPage:Number;
            private var originalHeightPage:Number;

            public function doAction(myClass:*):void
            {
                areaDocument.removeAllChildren();
                thePrintView = myClass;
                areaDocument.addChild(thePrintView);
                originalWidthPage = thePrintView.width;
                originalHeightPage = thePrintView.height;

            }
            private function print():void
            {
                // renovando a configuração inicial
                mySlider.value = 100;
                thePrintView.scaleX = thePrintView.scaleY = 1;


                if(tipoImpressao.selectedIndex == 2){
                    // tipo de impressão matricial
                    var printJobMatricial:EpsonPrint = new EpsonPrint();
                    printJobMatricial.addPage(thePrintView);
                    printJobMatricial.printPages();
                }
                else{
                    // tipo de impressão imagem e vetor
                    var printJob:FlexPrintJob = new FlexPrintJob();

                    if(tipoImpressao.selectedIndex == 0)
                        printJob.printAsBitmap = true;
                    else
                        printJob.printAsBitmap = false;



                    if(printJob.start()){
                        thePrintView.width = printJob.pageWidth;
                        thePrintView.height = printJob.pageHeight;
                        printJob.addObject(thePrintView);
                        printJob.send();
                    }
                    thePrintView.width = originalWidthPage;
                    thePrintView.height = originalHeightPage;
                }
            }
            private function handlerHSlide():void
            {
                if(!thePrintView)
                    return;

                var theValue:Number = mySlider.value / 100;
                thePrintView.scaleX = thePrintView.scaleY = theValue;
                thePrintView.invalidateSize();
                thePrintView.invalidateProperties();
                thePrintView.invalidateDisplayList();
            }
            private function mySliderToolTip(value:Number):String
            {
                return value + " %";
            }
        ]]>
    </mx:Script>

    <mx:HBox width="100%" verticalAlign="middle">
        <mx:Button label="Imprimir" click="print()" cornerRadius="0"/>
        <mx:Spacer width="100%"/>
        <mx:Label text="Tipo de Impressão:"/>
        <mx:ComboBox id="tipoImpressao" cornerRadius="0" selectedIndex="1">
            <mx:Object label="Imagem"/>
            <mx:Object label="Vetor"/>
            <mx:Object label="Matricial"/>
        </mx:ComboBox>
        <mx:Spacer width="20"/>
        <mx:Label text="Zoom:"/>
        <mx:Canvas width="185" height="23" backgroundColor="#E8E8E8"
cornerRadius="7" borderStyle="solid">
            <mx:HSlider id="mySlider"
                x="10" y="0"
                change="handlerHSlide()"
                minimum="30" maximum="300"
                liveDragging="true"
                allowTrackClick="true"
                snapInterval="1"
                value="100"
                dataTipFormatFunction="mySliderToolTip"/>
        </mx:Canvas>

    </mx:HBox>
    <mx:Canvas id="areaCanvas" width="100%" height="100%">

        <mx:VBox
            id="areaDocument"
            width="100%" height="100%"
            backgroundColor="#AAAAAA"
            horizontalAlign="center"
            paddingTop="10"
            paddingBottom="10"
            paddingLeft="10"
            paddingRight="10"
            horizontalScrollPolicy="off"
            verticalScrollPolicy="off">
        </mx:VBox>

    </mx:Canvas>

</mx:TitleWindow>
-- 
Você recebeu esta mensagem porque está inscrito na lista "flexdev"
Para enviar uma mensagem, envie um e-mail para flexdev@googlegroups.com
Para sair da lista, envie um email em branco para 
flexdev-unsubscr...@googlegroups.com
Mais opções estão disponíveis em http://groups.google.com/group/flexdev

Responder a