1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    14
    Vote Rating
    0
    dadaking is on a distinguished road

      0  

    Default Unanswered: How feed PDF panel with binary

    Unanswered: How feed PDF panel with binary


    Hello,
    I have a panel where I put a PDF file. This work with the src parameters:

    Code:
    id: 'pdfFrame',xtype: 'component',
    autoEl: {
        tag: 'iframe',
        style: 'height: 100%; width: 100%; border: none',
        src: 'FILE.PDF'
    }
    But now I receive a ZIP file which contain the PDF file (or much). I must extract the file (I do that) and give the stream to the panel (I can't save the file for use it). How can I give the stream for display it?

    I must perhaps give the data by an other way?

    Thank you in advance for your answers

    Regards,
    David

  2. #2
    Sencha User
    Join Date
    Sep 2012
    Posts
    14
    Vote Rating
    0
    dadaking is on a distinguished road

      0  

    Default


    I found the solution!

    It was no hard, I request an url which do the extract and return an http response with the byte[] direct in the src.

    If I can help another poeple.

  3. #3
    Sencha Premium Member
    Join Date
    Oct 2012
    Posts
    11
    Vote Rating
    0
    bar@egeli is on a distinguished road

      0  

    Default


    Is your solution working in Internet Explorer (9)?
    Whatever I try, i can't manage to show a byte array in Internet Explorer.
    Byte Array in Chrome: done
    PDF-File in IE9: done
    Byte Array in IE9: absolutely no idea...

  4. #4
    Sencha User
    Join Date
    Sep 2012
    Posts
    14
    Vote Rating
    0
    dadaking is on a distinguished road

      0  

    Default


    Yes,
    I have the same function for all browser (except IE7/8) and it looks like to work.
    I have create a method which return a byte array and I put it in the src param.

  5. #5
    Sencha Premium Member
    Join Date
    Oct 2012
    Posts
    11
    Vote Rating
    0
    bar@egeli is on a distinguished road

      0  

    Default


    OMG!
    That sounds exactly to what I'm looking for!!!

    What I tried:

    Code:
    Ext.define('Ext.ux.form.DocumentFrame', {    
        extend: 'Ext.container.Container',
        alias: 'widget.documentframe',
        layout: 'hbox',
        initComponent: function () {
            var me = this;
            var binaryData = me.value.DocumentData;
            var source = 'data:application/pdf;base64,' + (binaryData);
    
    
            Ext.applyIf(me, {
                items: [
                        {
                            xtype: 'component',
                            itemId: 'panel-document-frame',
                            width: 600,
                            height: 600,
                            autoEl: {
                                tag: 'iframe',
                                width: '100%',
                                height: '100%',
                                src: source
                            }
                        }
                ]
            });
            me.callParent(arguments);
        }
    });
    But the PDF just won't show!
    You noted a function, which returns your byte array. Could you please give me a little more information about that function???

    That would be really, really awesome!!!

    I also questioned that problem on stackoverflow: http://stackoverflow.com/questions/17675103/extjs-show-pdf-from-byte-array-in-javascript
    b
    ut there's no response until now...

    It would be really awesome if you could help me!!!
    Last edited by bar@egeli; 17 Jul 2013 at 12:20 AM. Reason: link to stackoverflow

Thread Participants: 1

Tags for this Thread