PDF File Security Settings - python

What are the Python modules/libraries which can be used to change or set the permissions of PDF file? I want to disable Print, Save, Save as, Copy for PDF file.

I think it's impossible. The browser display PDF file as local file. So when user can see the PDF, it is already be downloaded.
You can display the file using another format, instead of browser's PDF viewer. See this site as a example: http://wenku.baidu.com/link?url=_u5cgVNlfyprUwDiVVUWWYyNh5QFdF9MeG099qZtyHZ4r4_QUV3C9JZlhIcNTTefgvjdH1gvFUuNrwyJzw8S_JlySBs5NAVc23MG5lG9Uey

Related

How to get the last used path for saving file

I want to make a tool of replace the path of image in markdown file by a http url. i implement that a shortcut can paste the http url of image from the clipborad. then i want to add a function that we can save the image in my computer, and use a shortcut to paste the http url of last saved file. so i need to get the last used path for saving file.
i have search the problem in google.but there are few relevant answers. in other words, maybe there are some solutions to get the newest saved file in PC.

Open PDF on specific page without setting acrobat file path

I am new in python and need your help.
I am writing a GUI in Python from which I would like to refer to specific pages in a PDF.
I can open a PDF on page x following this: Python Open PDF to Bookmark/Named Destination
However, I need to give the path to the Acrobat.exe which I image could be problematic when sending my GUI to someone else.
Is there a way to open a PDF on page x without setting the file path for Acrobat.exe?

Is there a way to change the filename of a file, when starting to download a file using Selenium?

I'd like to download multiple files from a single website, but the biggest quirk I have is that the server automatically generates a random filename upon requesting the file to download. The issue here is then I won't know which file is which, without having to manually go through each file. However, on the site that has the links to download the files, they all have a name. For example...
File name -> Resultant file name(fake file names)
Week1.pdf 2asd123e.pdf
Week1_1.jpg dsfgp142.jpg
.
.
Week10.pdf 19fgmo2o.pdf
Week11.pdf 0we5984w.pdf
If I were to download them manually by myself, I would type click "download" and a popup "Save as" menu comes up, which gives me the option to change the file name manually, then click ok to confirm the download, to which it starts downloading.
Currently, my code is made to open up the website, log into my account, go to the files page, and then find a file, with it's corresponding server request link. IE: . I am able to store the name of the file, "Week1.pdf" into a variable, and click on the request link, but the only problem is that the Save as menu, doesn't have the ability to change the name of the filename, and only gives me the option to view the file, or Save the file immediately. I've looked around a little, and tried to play around with the Firefox profile settings, but nothing has worked. How would I go about solving this problem?
Thanks
I can think of a few things that you might try...
After the file is saved, look in the downloads folder for the most recently saved file (with the correct extension) using time stamps. This will probably be OK as long as you aren't running this threaded.
Get the list of files in the download directory, download the file, find the file that doesn't exist in the list of files. Again this should be safe unless you are running this threaded.
Create a new folder, set the download directory to the newly created folder, download the file. It should be the only file in that directory. As far as I know, you can only set the download directory before creating the driver instance.
In each of these cases, if you plan to download multiple files I would rename each file as you download them or move them into some known directory to make it easier on yourself.
There's another method I ran across in another answer.

How to use python cgi code to search file and display in browser along with its name

I have a simple html file with text input for file name. It will search the file in the folders and display contents in the browser using cgi script. The file can be pdf or image file. Wish to display 'file name as well as the contents in the browser'. Currently it displays either file name or contents but not both depending on Content type selected. Kindly guide. I need the exact code.

pyramid static view and file upload

I created new directory via 'myimages' under static directory. And whenever user upload files, file get stores in that directory. Once file uploaded I can access that on html using '/static/myimages/imagename.png'. It works fine whenever I am uploading new image. But whenver I try to override image. It shows me old image only.
I manually check in directory. It has new image, but still when I try to access that via browser, it gives me old image.
This sounds like your browser is caching the images. Try setting the cache_max_age=0 on your add_static_view, or viewing the page in your browser's incognito mode where it'll use a different cache.

Categories