How to download a PDF from a website that is not downloadable?
I am working on a project that will involve a lot of downloading PDF files from a website.
One of the requirements is that the client cannot access the PDF and only an employee can download it. The thing is, I do not want to let anyone download the PDF but still want to tell them where the file is located so that they know how to get it.
I can go by using an iframe and make it inaccessible to anyone. But is there any other way I can accomplish this? Create an invisible proxy page with a link to the PDF (using ), on top of the page you have the following snippet in your iframe: . This should work on all major browsers.
How do I download a view only protected PDF from Google Drive?
I've tried two different methods for downloading a protected PDF.
The first is through the Google Drive Web UI, but that only works for local files. The second method I tried was via Python and the requests library.
The first method works great when you click on the PDF in the Google Drive UI and it downloads fine (if it's not protected). The second method doesn't work at all if you're trying to download it to your computer.
I'm using Google Drive API v3 and Python 2.7.
From oauth2client.fromjsonkeyfilename('gspread.json', scopes=scopes)
Service = build('drive', 'v3', credentials=credentials). # Or. Service = build('drive', 'v3', developerKey='YOUR-DEVELOPER-KEY'). Service = build('drive', 'v3', developerKey='YOUR-DEVELOPER-KEY'. clientId='YOUR-CLIENT-ID'). Response = service.files().exportmedia(body=,
mediaSource="FILEID"). Print response. Both of these will work with a non-protected PDF and return a 200 OK code. However, it won't work with a protected PDF, no matter what I try.
When I do it from the Google Drive UI, it will tell me I can't download it. When I try to do it from Python, it says "Invalid access token", or it doesn't do anything at all.
Related Answers
Is there a free program to convert PDF to Excel?
I've seen a few programs that are supposed to be able to c...
What is the free AI tool to extract information from a PDF?
I have tried several times to extract informati...
How can I open a PDF file in Excel for free?
How to Convert PDF to Excel for Free. Convert PDF to Exce...