开发者

How to create a PDF of my web application using AlivePdf

I have a large web application with verticalScrollBar with few charts and large datagrid. I am planning to create pdf of my web application using AlivePdf.

Right now, Im using below code to creat a pdf of my application, but no luck.

        var printView:DisplayObject  = new InteractionsAnalysis() as DisplayObject开发者_JAVA百科;
        printView.width = Application.application.width;
        printView.height = Application.application.height;          

    var printPDF:PDF = new PDF(Orientation.PORTRAIT, Unit.MM, Size.A4);
    printPDF.setDisplayMode( Display.FULL_PAGE, Layout.SINGLE_PAGE );
    printPDF.addPage();
    printPDF.addImage(printView,0,0,0,0,"PNG",100,1,ResizeMode.FIT_TO_PAGE);

   var f:FileReference = new FileReference();
   var b:ByteArray = printPDF.save(Method.LOCAL);
   f.save(b);

Can anybody give me some directions?


Verify that the method which is calling f.save() was triggered due from a user event. According to the FileReference doc:

In Flash Player, you can only call this method successfully in response to a user event (for example, in an event handler for a mouse click or keypress event). Otherwise, calling this method results in Flash Player throwing an Error exception. This limitation does not apply to AIR content in the application sandbox.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜