1 Reply Latest reply on Jun 10, 2015 3:36 AM by ethan25

    How to extract the content of AdvancedDataGrid into PDF in FLEX

    ethan25

      I'm using AlivePDF library to extract the content of AdvancedDataGrid into PDF but its not working.

      i have tried the below

       

      var howToResize:String = ResizeMode.FIT_TO_PAGE;

      myPDF = new PDF(Orientation.PORTRAIT,Unit.MM,Size.A4);

      var newPage:Page = new Page(Orientation.PORTRAIT,Unit.MM,Size.A4);

      myPDF.addPage(newPage);

      myPDF.addImage(dataGridPrint,0,0,0,0,ImageFormat.PNG,100,1,howToResize);

      myPDF.save(Method.REMOTE,URLExporter,Download.ATTACHMENT,ResourceManager.getInstance().getString("la bels","pdf_name"));

       

      dataGridPrint is as below:


      <mx:AdvancedDataGrid id="dataGridPrint" visible="false" width="100%" height="100%">

                  <mx:columns>

                  <mx:AdvancedDataGridColumn dataField="FirstName" headerText="First Name"/>

                      <mx:AdvancedDataGridColumn dataField="LastName" headerText="Last Name"/>

                  </mx:columns>

      </mx:AdvancedDataGrid>

       

      PDF is not getting downloaded.

        • 1. Re: How to extract the content of AdvancedDataGrid into PDF in FLEX
          ethan25 Level 1

          Use flex SDK 3.6A and flash compiler version 10.1 and above

           

          var howToResize:String = ResizeMode.FIT_TO_PAGE;

          myPDF = new PDF(Orientation.PORTRAIT,Unit.MM,Size.A4);

          var newPage:Page = new Page(Orientation.PORTRAIT,Unit.MM,Size.A4);

          myPDF.addPage(newPage);

          myPDF.addImage(dataGridPrint,0,0,0,0,ImageFormat.PNG,100,1,howToResize);

          var bytes:ByteArray=newPDF.save(Method.LOCAL);

          var f:FileReference=new FileReference();

          f.save(bytes,"test.pdf");