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

Unable to load PDF file larger than 128K on iOS 10.2 #170

Closed
jyxzfw opened this issue Jan 16, 2017 · 7 comments
Closed

Unable to load PDF file larger than 128K on iOS 10.2 #170

jyxzfw opened this issue Jan 16, 2017 · 7 comments

Comments

@jyxzfw
Copy link

jyxzfw commented Jan 16, 2017

Hi, I am trying to use angular-pdf on my ionic APP to display pdf file.
I set the parameters $scope.pdfUrl to "http://xxx.xxx.xxx.xxx:xx/FileStoreService/DownPDF.ashx?fileNumber=xxxxxxxx".
And it worked very well on iOS 8.2, until I upgraded IOS to 10.2.
I find that when PDF is less than 128K, it works properly.And no errors in the logs too.Why?
Thanks for every help

@dennybiasiolli
Copy link
Collaborator

Hi @jyxzfw , thanks for the issue!
Are you sure you don't have any kind of restrictions on your app, eventually introduced on IOS 10?

@jyxzfw
Copy link
Author

jyxzfw commented Jan 17, 2017

Hi @dennybiasiolli , thank you for your prompt reply!
Restrictions on my app? No. I don't even know where to set restrictions. In my Xcode?
I'll describe my problem in detail again:
At last year, I used angularjs-pdf on iOS 8.2, and it works very well. All my PDF files on the file server, so I took $scope.pdfUrl to "http://xxx.xxx.xxx.xxx:xx/FileStoreService/DownPDF.ashx?fileNumber=xxxxxxxx". Recently, I upgraded my phone to iOS 10.2, and then it didn't work. I checked the console and found It can only load up to 131072 bytes of data. This means that only PDF less than 128KB can be loaded.
This is the progress of the log:
2017-01-17 15:04:19.756391 移动OA[17087:4488448] {"loaded":3511,"total":272348}
2017-01-17 15:04:19.802841 移动OA[17087:4488448] {"loaded":65536,"total":272348}
2017-01-17 15:04:19.820034 移动OA[17087:4488448] {"loaded":65536,"total":272348}
2017-01-17 15:04:19.820183 移动OA[17087:4488448] {"loaded":131072,"total":272348}
See, it should have loaded into the 272348, but it only loaded 131072. And in the console,there is no other log. When the second time I open the PDF, it prompts me an exception:
2017-01-17 15:05:01.591878 移动OA[17087:4488448] UnexpectedResponseException: Unexpected server response (206) while retrieving PDF "http://xxx.xxx.xxx.xxx:xx/FileStoreService/DownPDF.ashx?fileNumber=xxxxxxxx".
I have been suffering by this problem for several days.
Thanks again for your help

@dennybiasiolli
Copy link
Collaborator

dennybiasiolli commented Jan 17, 2017

According to this issue, it seems a problem with an older version of pdf.js, resolved by this PR
What version of pdf.js do you use?
If you try to update your pdf.js, does the error remains?

@jyxzfw
Copy link
Author

jyxzfw commented Jan 18, 2017

Yes, it is also so. I used the latest version(v 1.5.0), and had built a test ionic project.
log:
2017-01-18 10:37:44.102043 newTestAngularjsPDF[17300:4589611] {"loaded":2211,"total":272348}
2017-01-18 10:37:44.156635 newTestAngularjsPDF[17300:4589611] {"loaded":54211,"total":272348}
2017-01-18 10:37:44.175461 newTestAngularjsPDF[17300:4589611] {"loaded":65536,"total":272348}
2017-01-18 10:37:44.206529 newTestAngularjsPDF[17300:4589611] {"loaded":65536,"total":272348}
2017-01-18 10:37:44.206900 newTestAngularjsPDF[17300:4589611] {"loaded":131072,"total":272348}
It also loaded only 131072 bytes.
But I found that the example you provided were good. I set $scope.pdfUrl="http://xxx.xxx.xxx.xxx:xx/FileStoreService/DownPDF.ashx?fileNumber=xxxxxxxx", then open with Safari. It works very well!
So I guess angularjs-pdf doesn't support the latest IOS.

@dennybiasiolli
Copy link
Collaborator

dennybiasiolli commented Jan 18, 2017 via email

@jyxzfw
Copy link
Author

jyxzfw commented Jan 18, 2017

I did what you said. I have tried to install this version with npm i pdfjs-dist.
[email protected] node_modules/pdfjs-dist
└── [email protected]
But unfortunately, it is still so. : (

@dennybiasiolli
Copy link
Collaborator

Hi @jyxzfw,
Can you provide us an example project so we can inspect more?
Thanks!

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

3 participants