Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors on IOS v 9 #935

Closed
blairjo opened this issue Apr 1, 2017 · 9 comments
Closed

Errors on IOS v 9 #935

blairjo opened this issue Apr 1, 2017 · 9 comments

Comments

@blairjo
Copy link

blairjo commented Apr 1, 2017

I have an old IPhone 4 for testing and my angular site was working fine on IOS v 8.
Yesterday, I updated the phone to IOS V 9.3.5 and the site started to crash during the angular initialisation.

The error is coming from this code in pdfmake :

if (distance < 0) {
  throw new Error('[BrotliDecompress] invalid distance');
}

I don't have a mac to debug this so tracking the issue down is difficult (I got the error above from a friend's mac)

Here's what I know so far:

  • On newer IOS devices it is fine
  • On browsers it is fine
  • On older IOS devices it is fine on v8
  • The problem only occurs when running the grunt minified build - if I run the unbuilt source it is ok.

Is this a known issue?

Thanks

@elirov
Copy link

elirov commented Apr 11, 2017

Getting the same thing. Going to try upgrading to 0.1.27 and see if that helps...

@blairjo
Copy link
Author

blairjo commented Apr 11, 2017

@elirov I had the same issue on 0.1.27 I think.
I have got round it for now by moving the pdf generation to the server instead, using the pdfmake node js library. There is a nice example showing how in the dev-playground folder in the source.

@elirov
Copy link

elirov commented Apr 11, 2017

Darn.. I was hoping they fixed it in 0.1.27. What happens if we just comment out the if statement? At least, until they fix the issue...

@blairjo
Copy link
Author

blairjo commented Apr 11, 2017

it's not that simple I'm afraid. That code snippet above is part of the BrotliDecompress library that is being sucked in as a dependency and browserified.
I see the recent releases were to do with "webpack hacks" so my suspicion is that something odd is happening there. I don't use browserify or webpack though, so I don't know too much about them.

If I were you, if you are able to move your code to the server, I'd do that.

@liborm85
Copy link
Collaborator

liborm85 commented Apr 12, 2017

Some versions included "webpack hacks" because some fonts could not be loaded. It was fixed in new version fontkit.

Brotli is dependency of fontkit I do not know what to use it, but for this library I'm not create any webpack hacks.

I don't know where the problem is. And I don't have iOS for testing...

@blairjo
Copy link
Author

blairjo commented Apr 12, 2017

I don't have access to a mac for debugging so I can't help too much either I'm afraid.
My best guess is that there is some conflict between the grunt minification process and whatever webpack does. I say that because if I don't minify the code it seems to work ok.

Having said that, I'm not sure it explains why it would work fine on IOS 10 / browsers etc..

@pablomaurer
Copy link

pablomaurer commented Apr 18, 2017

Now I would like to join the club, and I have all the hardware required to debug this.

While trying to figure out more, I did setup up an ionic-2 project and included pdfmake again. And see there in ionic-2 it works on IOS9perfectly fine.

So it has something todo with those module bundling stuff I'm not into. In ionic-2 they use webpack and rollup in ionic-1 I use a gulpfile with browserify and tsify..

So I tried to use webpack in ionic-1 doesn't help, but is much faster =)

fails

  • IOS9 & ionic-1 with browserify, tsify
  • IOS9 & ionic-1 with webpack

works

  • IOS9 & ionic-2
  • IOS10 & ionic-1

I'm switching to cordova-pdf-generator, because even this got fixed,it's way to slow with some many images on older devices.

But ping me if you have an idea of what i can test.

@ZaDarkSide
Copy link

ZaDarkSide commented Apr 26, 2017

I have the same problem on iOS 9.3.5 iPad Mini on Safari, can anyone please fix this?

I have opened a new issue here too foliojs/brotli.js#18

@liborm85
Copy link
Collaborator

Follow here: foliojs/brotli.js#18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants