0 Replies Latest reply on Aug 13, 2015 9:41 PM by satishlsk

    FileReference save

    satishlsk Level 1

      My requirement is to save a bunch of files (more than 500) in a single zip file locally using FileReference. I am using ASZip to zip the files. Now the problem is if the number of files are more, then I am not even getting Save as dialog box.

      I have tried different combinations of data to see whether it is number of files or file size limitation, but it looks like the script automatically stops, if it takes more than 1 minute (in both IE and Chrome)

      This is the code that I am using

        //*****test code
      var myZip:ASZip = new ASZip (CompressionMethod.GZIP);
      var myByteArray:ByteArray = new ByteArray();var pdfFile:PDF;
      var newPage:Page;
      var printPage:BorderContainer;
      for (var i:int=0;i<330;i++)
      {
        printPage
      = new BorderContainer();
        printPage
      .visible = false;
        printPage
      .x=0;
        printPage
      .y=0;
        printPage
      .includeInLayout = false;
        printPage
      .width = 816+10;
        printPage
      .height = 1056+23;
        
      this.addElement(printPage);
        pdfFile
      = new PDF(Orientation.PORTRAIT, Unit.INCHES, Size.A3 );
        pdfFile
      .setDisplayMode( Display.FULL_PAGE,Layout.SINGLE_PAGE  );
        newPage
      = new Page ( Orientation.PORTRAIT,Unit.INCHES,new Size([816+10,1056+10],"MyFavoriteSize",[8.5+10,11+10],[816/0.125,1056/0.218]));
        pdfFile
      .addPage(newPage);
        pdfFile
      .beginFill(new RGBColor(0xFFFFFF));
        pdfFile
      .textStyle(new RGBColor(0x000000));
        pdfFile
      .addImage(printPage,null,-0.5,-0.5,8.5+4,11.5+4);
        myByteArray
      = pdfFile.save(org.alivepdf.saving.Method.LOCAL);
        myZip
      .addFile(myByteArray,i + ".pdf");
      }

      var file:FileReference = new FileReference();

      var myZipFile:ByteArray = myZip.saveZIP(org.aszip.saving.Method.LOCAL);

      file.save(myZipFile, "testzip.zip");

      Please help.

      Thanks,

      Satish.