gdtiti / alivepdf

Automatically exported from code.google.com/p/alivepdf
0 stars 0 forks source link

PDF Generation Void #227

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi to every body and thank you for your help

What steps will reproduce the problem?
1. I have a medium application made in Adobe Flex 3 Builder SDK 3.5 , i'm 
using PHP and MySQL.

Inside an AdvancedDataGrid i have a checkbox ItemRenderer , when the users 
make a click on this checkbox a PDF file is generated with AlivePDf 0.1.5 
and some data of the database and some text, until here everything is 
working fine.

Optimising my code and the speed of the application i make some changes, 

The part of the generation of the PDF was moved to a button below the ADG, 
here the problems come:

2. When the users click the button the PDF save popup windows never appears

3. I have all the import clasess nedeed in the script 
The variables and the code is the same and fixed to work in the button

What is the expected output? What do you see instead?

I expect the PDF saving popup window

What version of the product are you using? On what operating system?

I'm using Windows 7 Pro for Develop
The users use Windows XP Pro, and Windows Vista Bussines

Please provide any additional information below.

Here is part of my code working:

<mx:DataGridColumn headerText="Email" textAlign="center" width="35" 
editable="false" dataField="correoCol1">
 <mx:itemRenderer>
  <mx:Component>
    <mx:CheckBox selected="{(int(data.correoCol1) == 1)?true:false}" 
click="{data.correoCol1 = (data.correoCol1 != 1) ? 1 : 0;}" 
change="onChange(event);">
      <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import flash.sampler.NewObjectSample;
    import flash.utils.ByteArray;
    import mx.collections.ArrayCollection;
    import mx.events.FlexEvent;

    import org.alivepdf.colors.RGBColor;
    import org.alivepdf.fonts.FontFamily;
    import org.alivepdf.layout.Align;
    import org.alivepdf.layout.Orientation;
    import org.alivepdf.layout.Size;
    import org.alivepdf.layout.Unit;
    import org.alivepdf.pages.Page;
    import org.alivepdf.pdf.PDF;
    import org.alivepdf.saving.Method;  
    import org.alivepdf.links.HTTPLink;

    import org.alivepdf.saving.Download;    
    import org.alivepdf.images.ResizeMode;
    import org.alivepdf.images.PNGImage;
    import org.alivepdf.images.JPEGImage; 
    import org.alivepdf.display.Display;
    import org.alivepdf.display.PageMode;
    import org.alivepdf.images.*;
    import org.alivepdf.fonts.Style;
    import flash.utils.Timer;
    import flash.events.TimerEvent;

    [Embed( source="/imagen/vtw_JPG.jpg" , mimeType="application/octet-
stream")]
    private var jpgBytes:Class;

    private var myPDF:PDF;

    [Bindable]
    public var cnumero:Number;
    private var valor:Number;

    private function onChange(evt:Event):void{
            /// HEre the vars come 
                myPDF = new PDF (Orientation.PORTRAIT, 
Unit.MM, Size.LETTER);
                myPDF.addPage();
                myPDF.addImageStream(new jpgBytes() as 
ByteArray,0,0,0,0,1,"FIT_TO_PAGE");
                myPDF.setFont(FontFamily.TIMES, 
Style.NORMAL);
                myPDF.textStyle(new RGBColor(0x8f5c30),1);
                myPDF.setFontSize(13);
                myPDF.addText(fecha_comp,20,70);
                myPDF.addText("MR. "+nombre1,20,76);
                myPDF.save
(Method.REMOTE,"http://internalserver/appfolder/create.php",Download.ATTACH
MENT,identificador+".pdf");
        }
    ]]>
    </mx:Script>

    </mx:CheckBox>
    </mx:Component>
        </mx:itemRenderer>
    </mx:DataGridColumn>

and here is the part of the code that don't works

<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" 
layout="absolute" 
    width="900" height="550" close="removePublisher(event)"
    backgroundAlpha="1.0" color="#DCF3F6" backgroundColor="#5D748C"
    alpha="0.90" borderStyle="solid" creationComplete="traeDatos()" 
horizontalAlign="center" verticalAlign="middle">

<mx:Script>
    <![CDATA[

        import org.alivepdf.pdf.PDF;
        import org.alivepdf.layout.Orientation;
        import org.alivepdf.layout.Unit;
        import org.alivepdf.layout.Size;
        import org.alivepdf.fonts.*;
        import org.alivepdf.colors.RGBColor;
        import org.alivepdf.links.*;
        import org.alivepdf.saving.*;
        import org.alivepdf.pages.Page;
        import mx.rpc.events.ResultEvent;
        import mx.managers.PopUpManager;
        import mx.controls.Alert;
        import mx.events.CloseEvent;
        import mx.utils.ObjectUtil;
        import mx.collections.XMLListCollection;
        import mx.printing.FlexPrintJob;
        import mx.printing.FlexPrintJobScaleType;
        import mx.utils.ArrayUtil;
        import mx.collections.ArrayCollection;
        import flash.sampler.NewObjectSample;
        import flash.utils.ByteArray;
        import mx.collections.ArrayCollection;
        import mx.events.FlexEvent;
        import flash.utils.Timer;
        import flash.events.TimerEvent;

        [Bindable]
        public var tradedid:Number;

        [Embed( source="/imagen/vtw_JPG.jpg" , 
mimeType="application/octet-stream")]
        private var jpgBytes:Class;

        private var archivoPDF:PDF;

        private function doPDF(evt:MouseEvent):void 
        {
            // vars section

            archivoPDF = new PDF 
(Orientation.PORTRAIT,Unit.MM,Size.LETTER);
                archivoPDF.addPage();
                archivoPDF.addImageStream(new jpgBytes() as 
ByteArray,0,0,0,0,1,"FIT_TO_PAGE");

            archivoPDF.setFont(FontFamily.TIMES, Style.NORMAL);
            archivoPDF.textStyle(new RGBColor(0x8f5c30),1);
            archivoPDF.setFontSize(13);

            archivoPDF.addText(fecha_comp,20,70);
            archivoPDF.addText(nombre1,20,76);
            archivoPDF.save
(Method.REMOTE,"http://192.168.0.100/testpdf/create.php",Download.ATTACHMEN
T,identificador+".pdf");
        }

    ]]>
</mx:Script>

    <mx:Panel layout="absolute" top="20" bottom="30" left="20" 
right="20" id="panel1" title="Datos de Cliente y Propiedades" 
        color="#E3E6E6" fontSize="12" fontWeight="normal" >
                <mx:DataGrid y="181" width="750" 
height="192" id="props1" editable="false" horizontalCenter="0" 
color="#1A3C3F" 

    dataProvider="{resorts.lastResult..resorts_data}" >
                    <mx:columns>
                        <mx:DataGridColumn 
headerText="#" dataField="cnumCol1" textAlign="center" width="35"/>
                        <mx:DataGridColumn 
headerText="Resort" dataField="nresortCol1" textAlign="left"/>
                        <mx:DataGridColumn 
headerText="Value Received" dataField="valueCol1" width="100" 
textAlign="right"/>
                        <mx:DataGridColumn 
headerText="Tranfer Fee" dataField="transferCol1" width="90" 
textAlign="right"/>
                        <mx:DataGridColumn 
headerText="Maint. Fee" dataField="" width="90" textAlign="right"/>
                        <mx:DataGridColumn 
headerText="FN1" width="10" visible="false" dataField="fn1Col1"/>
                        <mx:DataGridColumn 
headerText="LN1" width="10" visible="false" dataField="ln1Col1"/>
                        <mx:DataGridColumn 
headerText="FN2" width="10" visible="false" dataField="fn2Col1"/>
                        <mx:DataGridColumn 
headerText="LN2" width="10" visible="false" dataField="ln2Col1"/>
                        <mx:DataGridColumn 
headerText="EMA" width="10" visible="false" dataField="emaCol1"/>
                        <mx:DataGridColumn 
headerText="PHO" width="10" visible="false" dataField="phoCol1"/>   

                    </mx:columns>
                </mx:DataGrid>

                <mx:Button y="392" label="Atras" 
horizontalCenter="-347" color="#1A3C3F" click="sendComment()"/>
                <mx:Button y="392" label="Enviar Correo" 
color="#1A3C3F" id="btnEmail" click="doPDF(event);" x="358.5"/>

            </mx:Panel> 

</mx:TitleWindow>

Original issue reported on code.google.com by jonathan...@gmail.com on 19 Apr 2010 at 5:21