1

While everything seems to work fine, when debugger hits pres.writeFile() function , i cant get the pptx at all. Mostly like a promise-base issue. Of course when testing with Chrome everything works as expetexted. Anyone face any similar issue before? Any suggestions? What's wrong with IE11?

    var pres = new pptxgen();

function fetch_data(el) {
    $.ajax({
        url:`${document.querySelector('.off-to-see-the-wizard > .route').innerHTML}`,
        contentType:"application/json",
        dataType:"json",
        success:function(response){
            if(response)
            {                 
                var data=JSON.parse(response);
                createPresentation(data,el);
            }
            else{
                console.log(response)
            }
        },
        error:function(err){
            console.log(err);
        }
    })
}


function createPresentation(data){
    var second_image="image/base64 ...."
    var main_image="image/jpg;base64 ..."

    function createMasterSlide(pres){
        pres.defineSlideMaster({
                title:'MASTER_SLIDE',
                bkgd:  'FFFFFF',
                objects:[
                    {'text':{text:`Test ${data._gateDescript} review`,options:{color:'000000',x:4.7,y:6.77,h:0.46,w:3.63, fontSize:14}}},
                    {'image':{x:0.3,y:6.47,w:1.14,h:0.83,data:second_image}}
                ],
                slideNumber: { x:9.11, y:6.77 ,w:0.43 ,h:0.42}
            })
        }
    function createMainSlide(pres){
        pres.author="Team";
        pres.layout='LAYOUT_4x3';
        let main_slide=pres.addSlide();
        main_slide.addImage({data:main_image, w:10, h:7.5})
        main_slide.addText(`Project ID:  ${data._p.Id}\nProject Name: ${data._p.Name}`, {color:'D55C00' ,x:0.47, y:3.56, w:5.0, h:0.7, fontSize:24})
        main_slide.addText(`Review: Test ${data._gateDescript} \nDate: ${Date.now()} `)
        }

    createMasterSlide(pres);
    createMainSlide(pres);
    pres.writeFile('Presentation.pptx');
}

Quick Update Error : Please see image attached. Error

Ι get to know that jszip has an issue with ie11 To be specific pptxgenjs make use of jszip , that runs generateInternalStream. In the scope of this function something breaks out. Any clues?

EDell
  • 26
  • 4
  • 1
    It's IE, basicly with an ES5 JS engine and outdated DOM. Use Babel or just drop the support for IE, its vendor has dropped the developement of that browser for years ago ... – Teemu Mar 26 '20 at 16:41
  • I m using webpack and have already babel loader ...well , i m so confused – EDell Mar 26 '20 at 17:28
  • The error message refers to a failed monkey patching or subclassing of a native object, but noone can say anything exact without seeing the code. – Teemu Mar 26 '20 at 18:40
  • Could you please provide [a minimal, reproducible sample](https://stackoverflow.com/help/minimal-reproducible-example) so that we can have a test and see how to help? With only the above description, we can't locate the issue. Thanks for your understanding. – Yu Zhou Mar 27 '20 at 02:55
  • Well , when code hits pptx.writeFile('test-pptx') using ie11 then pptxgen.es.js is called and in there i get the error of the description. – EDell Mar 27 '20 at 10:25

2 Answers2

0

Which version of jszip are you using? It seems that pptxgenjs@3.1.1 uses jszip v3.2.1 for default.

I found some have the same error when using jszip version 3.2.x in IE and Edge. You could refer to this thread. The last version not having this problem is 3.1.5. You could try with jszip version 3.1.x.

Yu Zhou
  • 11,532
  • 1
  • 8
  • 22
  • I have looked into this thread prior to opening this one. I get same error using jszip 3.1.5 ! You just got me wondering. That when you isntall pptxgenjs package it needs jszip . Seeing that thread i installed jszip 3.1.5 as well. Maybe i m not isntructing pptxgens to use this jzip? Dunno, there is still this issue. By the way, when i webpack to make a bundle , most of my node modules are excluded while i set pptxgenjs not to be. Maybe i shouldn't exclude jszip as well? – EDell Mar 30 '20 at 08:09
  • @EDell Cheers! You could post your solution as an answer and mark your answer as an accepted answer. It can help other community members in future in similar kind of issues. Thanks for your understanding. – Yu Zhou Mar 30 '20 at 08:27
  • @Yu_Zhou Sure thing! Thanks again ! – EDell Mar 30 '20 at 12:08
0

Quick update for your reference . The issue was finally resolved by installing jszip 3.1.5 version. Its stable and functionally using IE11.

So you should install this specific version

npm install jszip@3.1.5 --save

Then please navigate to node modules , get to copy all jszip node module. Navigate back to pptxgenjs node module. Navigate into pptxgenjs--->node_modules and overwrite jszip with the version you have installed and copied previously.

So pptxgenjs lib would use jszip 3.1.5 version .

Issue resolved. Thanks everyone :)

EDell
  • 26
  • 4