Is it possible to unlock a PDF created by ColdFusion? - pdf

I am pretty sure I know the answer is no, but wanted to confirm with others.
Can you take a PDF document created by ColdFusion 8 via the following tag and remove the password protection so that changes can be made to the PDF, especially being able to add additional pages?
<cfdocument format="pdf" overwrite="true" encryption="128-bit" permissions="AllowPrinting" unit="in" margintop=".9" marginbottom=".5" marginright=".5" marginleft=".5">
As you can see no password is provided, this no password exists to pass into any method that would unlock the file.

Related

Convert ppt to pdf and protect the file

The below is the line of code I'm using it currently which converts ppt to pdf, however I want to protect pdf , Is there any possibility
PowerPointapp.ActivePresentation.SaveAs path & pdffileNm & ".pdf", 32
This is not possible with the default vba functions available!
See this, not tested by me, example of using an external library to save pdf with password in the past.
Protecting a PDF is not permanent, once the file is opened (using the users decryption key provided by handing over the password), the contents are available to the new owner to add comment or fill forms or otherwise modify by print or text edit or remove watermarks.
Adobe reader will use different parts of those keys to reduce user writes, but no other editor has to.
Browsers need to edit PDF in exactly the same way so my Firefox pdf reader allows me to correct / change web page content or the embedded pdf contents, exactly the same as any other browser or pdf viewer or editor can. The only protected PDF is an unpublished one.

Download pdf - accessibility for screen readers

I'm curious how to make an accessible button for screen readers which downloads PDF.
I know that there is an option using href and pass there an URL to the pdf file, and even a download attribute inside an anchor to open a download window.
But it's not a good way for a screen reader. The screen reader reads it as a link but actually, this is not a link because it triggers downloading a pdf file rather than redirect to another page. So this can be confusing for people with vision disorders who rely on their screen readers.
Is it a good accessibility way to create such a button? Or relying on <a href='path-to-pdf'>...</a> is completely enough and not confusing for people with disabilities ?
General answer and basics of file download
Both a link and a button are perfectly fine, it doesn't make much difference.
IN any case, it's very important to explicitly indicate that the link or button is going to download a file rather than open a page, to avoid surprise.
The simplest and most reliable is just to write it textually, i.e. "View the report (PDF)".
You may also put a PDF icon next to the link to indicate it, but make sure to use a real image, i.e. <img alt="PDF" /> and not CSS stuff, since the later may not be rendered to screen readers and/or don't give you the opportunity to set alt text (which is very important).
A good practice is also to indicate the file size if its size is big (more than a few megabytes), so that users having a slow or limited connection won't get stuck or burn their mobile data subscription needlessly.
It's also good to indicate the number of pages if it's more than just a few, so that people can have an idea on how big it is, and if they really can take the required time to read it.
Example: "View the report (PDF, 44 pages, 17 MB)"
Note that similarly, that's a good practice to indicate the duration of a podcast or video beforehand.
Additional considerations with PDF
First of all, you should make sure that your PDF is really accessible. Most aren't by default, sadly.
You should easily find resources on how to proceed to make a PDF accessible if you don't know.
Secondly, for an accessible PDF files to be effectively read accessibly, it has to be opened inside a real PDF reading program which supports tagged PDFs, like Adobe Reader.
The problem is that nowadays, most browsers have an integrated PDF viewer. These viewers usually don't support tagged PDFs, and so, even if you make an accessible PDF, it won't be accessible to the user if it is open inside that integrated browser viewer.
So you must make sure that your link or button triggers an effective download or opening in a true PDF reading program, rather than opening in an integrated viewer of the browser.
Several possibilities that may or may not work depending on OS/browser to bypass the integrated viewer. They have to be tested to make sure they work:
Send a header Content-Disposition: attachment; filename="something.pdf"
Send a Content-Type different than "application/pdf" or "text/pdf", e.g. "application/octet-stream" to fake out basic type detection
Make the link don't ends with .pdf
Use the download attribute of <a>
The most reliable are response headers. Most browsers don't rely only on file extension alone to decide what to do.
Either a link or a button is fine. The most important thing is that the user is informed about what the element does - i.e. it downloads/opens a PDF file. So, this should be reflected in the element's label, whether that is a visible text label or an icon that uses alt text or aria-label to explicitly describe the element's purpose.
I agree with Quentinc's suggestion to also inform the user upfront about the number of pages and size of the document - that's a nice touch that I don't see very often!
PDF accessibility is a whole other topic, but again as QuentinC points out, there's not much good in allowing a user to download or view a PDF that isn't accessible, so it's a good idea to ensure the PDF has been tested against JAWS/NVDA/VoiceOver/TalkBack to ensure it is readable.

Removing PDF password protection, knowing the password [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 1 year ago.
Improve this question
I have a bunch of pdf's I want to remove passwords from. Note that I know the password, so no need for brute forcing. I am working on a mac, so I would like to make an app to remove those passwords.
I have seen apps like wondershare's pdf password remover, so I know it is possible.
Is there a solution/library in the obj-c environment to remove passwords from PDF's?
ok. Here is the easy solution.
Open the pdf with google chrome.
Enter the password.
Print document using ctrl+p.
Choose Save as pdf option.
Done.
I think this would work for you. Both answers seem valid, I personally would opt for the second one.
Transcribed:
do shell script "pdftk secured.pdf input_pw foopass output unsecured.pdf"
I think you are looking for PSPDFkit. See this documentation here Documentation
You can do it in a way by iterating through all the pdf's and unlocking one by one.I am not sure if you are exactly looking for this type of solution, but may be helpful.
Iterate through all the PDf's and create a CGPDFDocument by passing the exact path of the pdf,
there is a method on CGPDFDocumentRef to check whether the document is password protected, which is "CGPDFDocumentIsUnlocked". If it is locked then unlock the file using the method:"CGPDFDocumentUnlockWithPassword".
save the unlocked document to a path and from then on you need not unlock each time you access it.
TNQ
Using Adobe Acrobat 9 Pro:
Open the document by putting the password.
Advanced -> Security -> Remove Security
Save the document
close and reopen with no password.
This is what i tried:-
Open the PDF file.
Enter the password for the first time.
Now to remove password "ctrl+p", then select this "Microsoft Print To PDF".
Then click on print,it will ask for location to save, give the details where you want to save and save it.
Done.
Note:-
To be more precise we don't need any browser for this it can be done in your local system.
Sometime you get some bank documents like form-16 etc, it will be password protected and you will not be having permission to modify due to security reason, due to some reason or might be you are using some organization system, so in that case this is helpful.
Steps to remove password security:
Right-click on the PDF file and select “Google Chrome” from the “Open with” menu or drag any password-protected PDF file (bank
statement) into your Google Chrome browser.
Now go to the File menu in Google Chrome and choose Print (or press Ctrl+P on Windows). Choose the destination printer as “Save as PDF”
and click the Save button.
Provide the file name and the file location and your duplicate PDF file will be saved in the specified location. Now upload the saved PDF
file.

Saving the modified contents of a pdf

I've got a form that I downloaded, I'd like to prefill some content on the form (this is easy using cfpdfform).
Where it gets tricky is I would like to allow the user to modify the contents of that form, and then somehow have those modified contents accessible to me. I didnt build the source PDF so I dont know how to allow the user to "save" the new contents so they can be read.
Any ideas on where I might start on this one?
You can also use the cfpdfform tag to read/write data to a PDF file which has a form. The important thing is that the PDF document already have the form fields available, or that you add them.
I just recently completed a task where I had to have a user fill out a normal web form, and then create a filled version of an existing PDF document. It worked like a breeze!
I think that depending on what you are trying to accomplish, having the user fill out the data in a web form is less confusing than serving up a PDF and expecting them to save that to update a file on a remote server. Just my opinion, though.
http://www.cfquickdocs.com/cf8/?getDoc=cfpdfform#cfpdfform
It's possible for users to complete most PDF forms in Adobe Reader, but when user's try to save the changes they get a popup prompting them that the PDF cannot be saved and would need to upgrade to Adobe Acrobat to have this functionality.
Since Acrobat 7 (or possibly) 8 it's possible to create a form so that it can be completed and saved in reader. In Acrobat open your PDF, and select Advanced -> Enable usage right in reader from the menu. This will prompt you to save the form and then anyone using Adobe reader can complete it.
Once that's done you can open the form in ColdFusion, populate some of the fields and serve it up to the user. Once they fill it in, save it and get it back in ColdFusion you can read the contents using the PDF related tags.
Please note: It's currently not possible to set the "enable usage rights in reader" flag from ColdFusion, you need a copy of Adobe Acrobat or access to Adobe LifeCycle server to do this.
This document may help you:
http://www.adobe.com/education/instruction/teach/coldfusion/CF8-2_advanced_cf8_development_unit8.pdf

Opening a password protected PDF Document

How do I programmatically open a password protected PDF. I want to use ruby to open a password protected PDF and read its content.
I would like to know whether its possible and if it is possible guidance on the right way to do it
not sure if you got anywhere with this but pdf-reader supports this functionality.
You can see the full discussion leading to the feature here: https://github.com/yob/pdf-reader/pull/18