In browser pdf viewer not working with React App - reactjs

My web app contains many links to various pdf files which are stored in Amazon S3. When I click on these links, the pdf file is downloaded even though my in browser, default, pdf viewer is enabled. If I install a third party pdf viewer, this fixes the problem, but I don't want my users to have to install an extension.
I tried adding each pdf link to the Google Docs pdf viewer url, but because these S3 pdf files are protected by their bucket policy, this doesn't work. I am 100% sure my default pdf viewer is enabled correctly, it works for other pdfs on the internet.
Has anybody run into this bizarre problem? Could I fix this with PDF.js? I am pretty sure the source of the problem is due to the pdf files being uploaded to S3 using http requests and not via the s3 client, but I still have no idea how to fix this.

I was able to upload PDF.js to my s3 bucket and concatenate the viewer.html to the pdf links on my apps, now everybody can view pdfs in browser without having an extension

Related

Is there a way I can prevent IDMs from auto downloading pdfs on any user's PC that is using my Website

I'm developing a react app that is to be used by students to access reading materials, I'm using React-pdf-viewer to view documents and it's all working fine but for users with IDM extension on the pdf doesn't load in the viewer but instead it gets captured by IDM and prompt the user to download instead. I'm serving the pdf to the react-pdf-viewer as URL from my server. Is there a way I can prevent any IDM from auto downloading the pdfs. Thanks in advance

ionic 5 PDFTron Webviewer doesn't have access to file URLs because of browser security restrictions

I try to integrate the PDFTron API in an ionic 5 application in which I download the pdf from the server, store them on the phone and then open them with the API
currently when I put the files in the assets folder of my ionic project, the api opens it without problem
but when I download the file to the phone memory and try to open it with the API by passing the link of this file, I have the following error (on the image)
Is there a way to fix this or store the downloaded files in the assets folder?
for those who encounter this same problem, just convert the native url (Ex file: ///storage/emulated/0/USL/20.PDF) into a url that the webviewer accepts using this:
let safeURL = win .Ionic.WebView.convertFileSrc (your native url);
you can also follow this link: where was file location downloaded in Ionic
For security reasons, browsers normally don't allow JavaScript pages to load local files from the local environment. Your option for this is to either use local paths if possible to run or to create a local server that access and serve the file to the client side.

pdf not opening in ie in production evironment with load balancer

I have a silverlight application with browsercontrol that needs to use Acrobat PDF Reader to display PDFs in the browser. I am using Acrobat Reader XI and internet explorer as browser. When the application is in the Stage environment everything works fine. However, when the application is in the Production environment pdf does not load or partially loads and stops. There is no difference between the two environments except production environment uses load balancer. The even weirder thing is that Production work and PDF loads when we hit a specific server URL instead of the load balancer URL. Why is it not loading. Why is this happening and better yet, how do I fix it?
Remember that Silverlight is a client technology. While you downloaded the initial site through the load balancer you live then on the client.
So the question is how do you load the pdf within silverlight?
If this is a direct url not through the load balancer the pdf file will not see the load balancer.
If the acrobat reader opens or not depends on the response mime-type and with pdf's this is a disscussion on its own.
Here you find a good stackoverflow question with an answer:
Proper MIME media type for PDF files
HTH

Is there a size limit to upload file using webapp2?

I am using appengine and writing my server code in python using webapp2. I am trying to upload video files from browser and save it to Google cloud storage. I use the form element in my HTML and webapp2 handler on server side to upload the file from browser. It works for files of smaller size, but when I try to upload a video file greater than 100MB, the browser throws the blow error
This webpage is not available
ERR_CONNECTION_RESET
I am unable to debug this on server side as it doesn't hit the post method.
Is there a config parameter in web app 2 that can be modified to upload files of greater size?
Any inputs is greatly appreciated.
App Engine has a limit of 32MB on all requests. You should upload your files directly to Google Cloud Storage, not through your server. This will also save you a lot of instance time.
EDIT: As Alex mentioned, signed URLs is a great way to let users upload and download files directly from GCS.

Google App Engine Blobstore not working suddenly

we've been running our app for a few months now and have had no problems. Suddenly this morning, all files uploaded to the blobstore can't be downloaded. They all download as a 0KB (empty) file. The old files in the blobstore that were uploaded before today still download without any problems. We haven't changed anything on the server or the app, we haven't even looked at the code in about 2 weeks, so is this a Google App Engine problem?
I checked the System Status page, which says everything is fine, but I noticed there isn't a Blobstore section on that page. How can I know if this is a Google problem or a problem with our app?
I've also checked the server logs, and there's nothing out of the ordinary...
Edit: I just checked the headers from the request to download a file from the blobstore. HTTP code is 200, everything is normal, except Content-Length is 0... When I look at that blob in the admin page, it says it is 123KB... Also, when I try to download the blob from the admin page, even though it says 123KB the downloaded file is still 0B...
Blobstore is working again. Downtime msg:
https://groups.google.com/forum/#!topic/google-appengine-downtime-notify/1gX2vRtAPCI

Resources