Can't open a pdf file that I copeid from Android data folder - file-extension

I have a study app that provides PDFs but these PDFs only open in the app itself even after downloading, like YouTube offline videos, I looked up for these saved files in the app data folder, but they have no extension. I tried different extensions so that I could open them, but they aren't opening.
Please help if you know how to open, I'm attaching a file via a Google Drive link.

In some systems file extensions may not be visible.
For a viewer to open a PDF, ideally it should have a file extension as .pdf.
Likewise if the file is badly defined or broken the PDF may not start with %PDF-1.7 or similar in the first line.
If a file is broken in transit parts may have become garbled and that seems to be what's happened to your personal copy of now broken pdf.
You need to repair the corruption by overwrite and save as repaired.pdf

Related

Chrome extension select folder for several downloads

I'm working on a chrome extension that scrapes pages and downloads images within the page. However, I've run into a sort of roadblock.
Since the extension is designed to download several files at once, I'd like for the user to be able to click the 'Download' button, select a folder, then download all the images to that folder.
So far, the only thing I've seen that might be of use is the saveAs option in chrome.downloads.download(). However, it would be very tedious for the user to have to select a location and confirm for every file. Is there a way I can have the user select a folder, then just download all the files to that specific folder?
Let me know if I need to include any specific code. Figured it wasn't very important, since I don't even have code pertaining to this question currently.
Unfortunately you cannot. Your options are
Ask the user each time
Save the files to the downloads folder set by the user or a sub folder
Although much more complicated you could use native messaging and have native code communicate with the extension. You could then wait for the extension to complete the download and then send a message to your native host with the full path. Then your native host can move the file to where you want.

User uploads Excel sheet - filetype is application/octet-stream

I have a web application running, laravel backend, where users upload Excel spreadsheets which then get stored, base64 encoded in a database. Mostly this works fine and the file is stored, looking like:
data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,UEsDBBQABgAIAAAAIQBi7p1oXgEAAJAEAAA
However recently a user has had problems, her files get uploaded and stored as:
data:application/octet-stream;base64,UEsDBBQACAgIAGVKWk0AAAAAAAAAAAAAA
If I download her files, they appear as perfectly OK Excel sheets, and if I upload them again, even without opening them, they upload as XML spreadsheets.
Where do I start looking for the problem? At what stage does this encoding get determined? Is the the uploading OS, the uploading browser, or might Laravel be doing something behind the scenes? I am not a Laravel expert.
As #ourmandave pointed out, browsers do not have a 100% reliable way to determine a MIME type:
MIME types from browsers
In this case, the user downloaded a Google Sheet from Google Drive on a Chromebook (as .xlsx) and then uploaded the xls to me. The file was fine (and could be interpreted as an .xlsx file) but the MIME type at the file start on different Chromebooks could be:
data:application/octet-stream;base64
or just
data:;octet-stream
Conclusion: don't place too much faith in the MIME type on file upload.
In my case, the problem was not related to the browser. We tried to upload a Microsoft Excel Worksheet (.xlsx) file from several machines running on Windows. Same browser versions of Chrome (Version 83.0.4103.106), Edge (Version 83.0.478.54) and Firefox (77.0.1 (64-bit)) were used.
The difference appeared between the machines that had MS Office installed and those that didn't.
On the machines with MS office all browsers accepted the file with:
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Browsers on the machines without MS Office accepted the file with:
Content-Type: application/octet-stream

XLS file downloads without file extension

I have a third party integration on a website and part of it is a downloadable Excel file. When downloading the file, there seems to be no file extension which results in the computer not knowing to which program the file should be opened with. If the extension is added manually it works just fine. This happens at least with Chrome on OSX.
I'm having trouble understanding where the problem is. Is it somehow possible to configure the server to add the file extension or is the problem in the browsers settings? Or is the only solution to ask the third party that serves the file to do something about it?
Thanks in advance.

How to display website in SWF files

I would like to create a shockwave file that can display a website with an internal webbrowser or something similar. The final target to display the website in a pdf file, but I think the only way to do this, is the swf trick.
I tried to find resources for this on the web, but found nothing.
UPDATE:
I am looking for a way to display a website in a downloadable pdf file. The website is only one html file fuelled by jquery and css.
Download SWF template for your website and edit it in macro media flash editor.
I would use a PHP script to create a PDF file (my choice for this kind of stuff is TcPDF, which has many example/how to scripts ready to use), and I'd put a captured image of my website in it; there are several websites offering this service for free, just google it, for example webthumbnail.org.
Disclaimer: I'm not linked to TcPDF nor Webthumbnail.org in any way, they are just the first examples that came into my mind.

How to detect in advance if a browser will download a file instead of viewing it?

Sometimes when you view a file on a page on its own, the browser has some default way of viewing it, like to place it in an image or video tag, or invoke some plugin. Other times, it just downloads the file.
Sometimes this is because of headers set by the server, but lets ignore that for now. For some file types, it doesn't matter what headers were set -- the browser will try to download them regardless.
Some of the types that the browser will view are listed in navigator.mimeTypes. However, this is not authoritative. The iPad can view Microsoft Office files but it does not report this.
Is there any simple way to figure out what the browser is going to do with a file before it does it?

Resources