ExtJS 4パネルにPDFをネスト

2714 ワード

原文住所:http://ext4all.com/post/extjs-4-show-pdf-in-a-panel
注意:ブラウザにPDFのプラグインをインストールする必要があることが前提です.例:Adobe Reader
効果図:
ExtJS4 Panel中嵌套PDF
 
<script type="text/javascript">

        Ext.onReady(function () {

            Ext.widget('panel', {

                title: 'My Pdf Panel      asp.net MVC',

                width: 600,

                height: 400,

                items: {

                    xtype: 'component',

                    autoEl: {

                        tag:'iframe',

                        style:'height:100%;width:100%;border:none',

                        src:'2.pdf'

                    }

                },

                renderTo:Ext.getBody()

            });

        });

    </script>

 
 ExtJS 3でパネルにPDFをネストする方法は以下の通りです.
http://ext4all.com/post/extjs-3-show-pdf-in-a-panel
Ext.onReady(function () {

    Ext.create({

        title: 'My PDF',

        xtype: 'panel',

        width: 600,

        height: 400,

        items: {

            xtype: 'box',

            autoEl: {

                tag: 'iframe',

                style: 'height: 100%; width: 100%',

                src: '/files/pdf-sample.pdf'

            }

        },

        renderTo: 'output'

    });

});