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

Failed to load resource. #207

Open
phkraehling opened this issue Aug 27, 2020 · 6 comments
Open

Failed to load resource. #207

phkraehling opened this issue Aug 27, 2020 · 6 comments

Comments

@phkraehling
Copy link

Im using pdftk and get an issue while im open the created pdf in safari (failed to load resource). Everything works fine on Chrome and Firefox.
The problem starts while I started to use SSL.

Safari starts to load the pdf, gets grey and then stops. The pdf menu (right click) is available.

@mikehaertl mikehaertl transferred this issue from mikehaertl/php-pdftk Aug 27, 2020
@mikehaertl
Copy link
Owner

@phkraehling I've moved the issue here, because this is the actual library that implements the download.

It's hard to say what's wrong here. You will have to do some debugging on your own. Just create a simple temporary file as shown in the README and then for example use curl -I to inspect the headers sent, etc. Also try to modify the download code - maybe you can make it work. Then we can see if we can implement a fix.

Also check if you have automatic compression enabled (mod_deflate on Apache or gzip on Nginx). We had some reports that this breaks the download. Also see mikehaertl/php-tmpfile#16

@mikehaertl
Copy link
Owner

@phkraehling Any news here? I don't have Safari so I can't do much. Help is very much welcome. I can also try to assist if it's unclear how to proceed.

@phkraehling
Copy link
Author

@mikehaertl sorry I took a look at the linked issue. But I'm not so familiar with this stuff.
I changed the code to save the file instead of send. After that I display the link. But the problem is the same.

@mikehaertl
Copy link
Owner

So you say the problem is also when you try to download a static file from your webserver with safari (completely outside this library and even PHP)? If that's the case there's nothing to fix here.

As a summary of mikehaertl/php-tmpfile#16: The main problem in our download code is probably the Content-Length header. It tells the browser how many bytes will be sent so it can show a progress bar during the download. If this header is missing there's no progress bar. Problem is that the size of the file is not always the "real" content-length because the webserver may ZIP the response and send less bytes than what is given in the header. It seems that especially Safari doesn't like this.

@phkraehling
Copy link
Author

No, I dont get the Problem with a third Party pdf.

I tried it with the pdf, filled with the library.

@mikehaertl
Copy link
Owner

Hmm, ok then maybe the issue is really something else and not related to the download code. Sorry for moving the issue to fast.

As I can't test I'd need your help here but not sure if you find time. What you could check:

  • Do all operations of php-pdftk fail? Or only filling forms?
  • If it's related to filling forms only: Test with different PDF forms. Also test with xfdf and also fdf format ( last argg in fillForm($data, $encoding = 'UTF-8', $dropXfa = true, $format = 'xfdf'))
  • Can you reproduce the issue if you create a PDF with pdftk on the command line (without this library)?

@mikehaertl mikehaertl transferred this issue from mikehaertl/php-tmpfile Sep 8, 2020
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

2 participants