attachment is not working in adobe reader - pdf

I have a fillable pdf with few text boxes in it and a save button. When the user fills the form and clicks the save button using Acrobat Pro I am able to save the data as an attachment in pdf, But the problem is When the user opens the pdf using Adobe Reader and try to do the same thing as above I am getting following error.
I have been searching for a week but no luck. Is there any way to make createDataObject() function work in Adobe Reader? or Is there any other way we can embed data into pdf?
Note: I am using Acrobat Javascript for this functionality. And I am using Adobe Reader version 11 and Acrobat pro version 11 and my OS is Windows.

What I have read so far is that getting file attachments working in Adobe Reader requires certain security settings to be enabled. Check out this Adobe forum post. According to it, attaching files from within Adobe Reader is only possible if you have Adobe Reader Extensions and allow users with Reader to add attachments.
I've been trying to get attachments working in Adobe Reader with Adobe LiveCycle and Adobe Pro myself, but also no luck so far. If anyone can give any workarounds, I'd be very interested in them myself.

Our workaround is to put a JS file in
/c/Program Files (x86)/Adobe/Acrobat DC/Acrobat/Javascripts/
or where ever.
This file has things like
app.PermittedFunction = function(some parameters here)
{
app.beginPriv();
Do fancy stuff here
app.endPriv();
}
app.trustedFunction(app.PermittedFunction)
Then we set button or menu Javascript actions as just
app.PermittedFunction(Generally pass in at least this so the file is clear)
And that should get you around the security errors.

Related

How to display custom content in protected PDF files?

When a PDF document is protected with a security policy from Adobe LiveCycle ES or Adobe AEM Forms, it can only be opened by Adobe Reader. Here's what it looks like when you try to open it in another PDF viewer.
Microsoft Edge:
Firefox (internally uses PDF.js):
But I have seen secured PDF documents that in other viewers show customised instructions to download and install Adobe Reader. Obviously there is a way to add unprotected content to protected PDF files, that other PDF viewers will display. How can I do it?
Here's an example of a PDF file I'm talking about.
When opened in Adobe Reader:
When opened in Firefox:
I also posted this question on Adobe forums, and someone replied with the correct answer there. AEM Forms has a feature that allows to add cover page to a policy-protected document: https://help.adobe.com/en_US/AEMForms/6.1/RMHelp/WS2d2a17056e219198-31ba356e14172797744-8000.html
I believe the only way to do what you are asking would be to supply the 'custom content' during initial authoring of the PDF with Adobe LiveCycle ES for instance.
(How this is accomplished may be similar to how it works for dynamic XFA content where the page contains some content that non-XFA compliant readers can fallback on to display instead of just erring out.)
But I think the only way to add such content to an existing PDF using non-Adobe software would involve violating the Rights Managment policy the author intended, which is not something you want to do.

Force a webbrowser to display a PDF file only on Adobe Acrobat Reader

I create a PDF with iTextsharp and then I show the preview of the PDF inside a webbrowser control. From the preview the user can SAVE or PRINT using the defaults Adobe Reader's buttons
Working on Windows x64 bits with Adobe Reader as the default PDF viewer everything works fine.
The same program on a Windows x64 bits but with Foxit Reader as the default PDF open the file on Foxit Reader on full application window, outside my program.
I need to manage that.
My code is like
Dim PathToPDF As String
PathToPDF = DirectoryOfMyApp & "\ReportPreview.pdf"
ReportPreviewWebBrowser.Navigate(PathToPDF)
Where DirectoryOfMyApp just gets the C: or D: letter of the hard disk.
I read this link
How to start an Adobe Reader or Acrobat from VB.NET?
but a line like
ReportPreviewWebBrowser.Navigate("acrobat", PathToPDF )
didn´t work and I think the webbrowser control don´t have the option to choose the PDF viewer
https://msdn.microsoft.com/es-es/library/system.windows.forms.webbrowser(v=vs.110).aspx
Is there a way to set the webbrowser to use Adobe Acrobat Reader only or to force any other PDF viewer to show the PDF inside the webbrowser control?
I agree with Zaggler on his comments on this. You are making assumptions at a certain point on software that is installed on an end user's computer. Unless you are going to make the application's PDF viewer be part of a dependency installation or cooked into .NET you cannot guarantee they have that program to use. Nor can you guarantee it's installed location.
However there is a cheap hack for Windows based processes you can do in VB.NET. You can use the ole System.Diagnostics.Process()
Sub Main()
Dim nProcess = New System.Diagnostics.Process()
nProcess.Start($"D:\PdfFile.pdf")
End Sub
In this example I did a quick file location, you can try to ensure it is a valid location that will not change or is in your app's running process folder. This is really low tech as far as development goes, but it is basically saying: "Run me a process, any process, at this location. I don't care what it is, use the Windows defaults to determine what to do with it."
So when I run this on my Windows 10 Dev box it loads up Edge to display it, at home it would fire up Adobe Viewer. It is just opening the file essentially with the OS's choice of what is using that file extension. Not glamorous or very good for hardened code but it works when you want something quick to happen.
No, you can't do this.
You can't even guarantee that Adobe Reader is installed at all.
Reader might not even exist on the machine. It's not built into Windows, and not everyone uses it. Even if it is, FoxIt isn't the only alternative. A big one is that Chrome includes it's own PDF viewer.

Prevent users from opening PDFs in Reader

We use a LiveCycle form, but don't utilize Reader Extensions as all of our internal users should have Adobe Pro installed. However, there are a handful (often new employees or people working from new systems), that either don't have Pro installed yet or have Adobe Reader opening PDFs by default.
Is there any way to either prevent a form from opening in Reader, or determine when a PDF is opened with Reader and display a message? The latter is ideal, as we could direct our users to see IT staff to install Pro.
This should be possible, see this link: http://www.serhatdundar.com/javascript-inside-pdf-detect-browser-acrobat-reader-version for more information.
Basically the link confirms that it is possible in Javascript (running within Reader or Acrobat) to detect which variation of the application is being used. Given that you can create PDF files with an "open script" - a script run when the file is being opened, that should answer your question.
Put an open script in all of your PDF forms.
User opens the PDF, the script is run.
The script then does the following:
Check application variation to detect Reader (as opposed to Pro)
Show dialog box with appropriate information if the variation is Reader.

prevent copy if pdf document (generated from word)

I'm a converting my Word document into pdf using the built-in microsoft office converter (save as--> pdf).
I want my pdf to be protected (users cannot copy text from it). i can't seem to find any options for this when converting to pdf.
Any hint?
Thanks.
Found it, Can be done with Adobe Acrobat Professional, not the Acrobat Reader.
PDF, or portable document format, forms were created by Adobe as a form of universal file format. Adobe Acrobat Reader, which allows you to view PDF files, is available for free download. Unfortunately, to manipulate documents and perform functions like changing security settings, you must have the full Adobe Acrobat software. With it, you can create secure PDFs, but you can also change security settings on PDF forms.
You can use export to PDF feature in LibreOffice, just set permission password and then disable Content Copying.

displaying a pdf on a windows form?

in vb.net is it possible to display a pdf file on a form?
If you're looking to display a PDF without needing Acrobat Reader installed on a client machine, take a look at this:
PDF Viewer Control Without Acrobat Reader Installed
I haven't tried it yet but probably will.
A quick hack for this would be to use a WebBrowser control (assuming the client has Adobe Reader installed) and navigate it to the PDF file you want to display.
yes, but you will end up using a COM+