0 Replies Latest reply on Apr 11, 2011 1:11 PM by Shravan P

    Need to open flex screen in a pdf by using AlivePDF

    Shravan P Level 1

      Hi all,

       

      I'm trying to get a screenshot of a flex application screen in a PDF(Adobe Reader). When i click on submit button, it supposed to show the screen in pdf page. VBox have some datagrid.

       

      I'm getting the screenshot, but its exceeding the height and width and also not getting clear screenshot.

      I just want to show as it is the flex screen.

       

      Can anyone help me out in this issue.

       

      Thanks in Advance.

       

      UI Component:

       

       

       

      <mx:VBox id="playout" width="100%" visible="false" backgroundColor="#FFFFFF" includeInLayout="false">

       

       

      </mx:VBox>

      <mx:Button

       

      id="printButton" label="Print" cornerRadius="10" onClick=doPrint(event:MouseEvent)" fontFamily="Arial"/>

       

       

      class file:

       

       

      private function doPrint(event:Event):void {

       

      var createPDF:PDF = new PDF(Orientation.PORTRAIT, Unit.MM, Size.A4);

       

      var image:ImageSnapshot = ImageSnapshot.captureImage(playout, 15, new JPEGEncoder());

       

      createPDF.addPage();

      createPDF.addImageStream(image.data, 0, 0, 500, 500);

       

       

       

      var ba:ByteArray = createPDF.save(Method.LOCAL);

       

      new

      FileReference().save(ba, "casedetails.pdf");

       

      }