How to generate a PDF form that can be used in both Mac Preview and Adobe Reader? - pdf

I previously had an Elance contractor generate a PDF form for me to use for invoicing purposes.
I like the form, but I only can open it using Adobe Reader(Mac) and not Preview.
Recently, I came across a form that can be opened and filled in using Preview AND Adobe Reader.
See here
My question is, how do I generate a PDF form that can be opened in both Preview and Adobe Reader?
I am asking for both:
manual generation (using a software or an application like Word or
Adobe Professional PDF)
programatically (using code or library,
preferably open source)

There are two main types of PDF forms, AcroForms, and XFA forms. Although I have not tested this, I suspect that if you want a PDF form to work with the Preview application, it should be enough if you avoid using XFA forms (usually PDF forms generated by Adobe LiveCycle) and embedded javascript code inside your PDF files. PDF forms using action buttons like "Clear Form", "Print" and "Submit" for example will always involve some javascript code.
Recommendations for libraries that allow you to create these forms will depend on the OS that you want to use for creating them, the programming language, etc. This question seems to have an extensive list o such libraries.

Related

Is there a recommended workflow to automate producing PDF forms with embedded javascript?

We use a lot of PDF forms with embedded javascript. We generate PDFs from LibreOffice, then use Acrobat to add PDF controls and javascript. This isn't working well, because a change to the appearance of the form in LibreOffice then causes additional work in Acrobat to put the PDF controls back where they should be, and then re-do the javascript.
Is there a smart way to generate PDFs with the PDF controls built-in (text input boxes, check boxes, radio boxes, digital signature boxes), with all the javascript included in the source file?
For example, is there a tool that could convert an html form with embedded javascript into a PDF with the same javascript running in the PDF?
I have a two step process.
First, create the PDF using Adobe InDesign. InDesign can add PDF interactive PDF fields to your document so that when exported, the fields are present.
The second step is to use a script to add scripted actions to each field like this...
this.getField("foo").setAction("MouseUp", "app.beep(0);");
See the documentation for more actions.

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.

Questions about PDF Form, Acrobat Reader, Browser PlugIns and JavaScript

With the latest Adobe PDF smart forms, following are my questions:
1) Could the PDF form itself detect or be aware of what client software itself is opened with?
2) When a PDF form is opened inside a browser plugin, could the script on the form read from browser cookies? and also could the script on the form write into browser cookies?
Thanks for the info.
"latest smart forms"… this has been done for the last 15 years…
To 1): The first distinction is to make whether the PDF viewer used understands (Acrobat) JavaScript.
If not, your smart form will remain dumb, and there is nothing you can change (if the viewer allows submitting data, you could do a server-side data processing and form filling and return the filled PDF to the client).
If the PDF viewer understands (Acrobat) JavaScript, you have the possibility to test for the kind of viewer, its version, as well whether it is external (which means whether you view the form under a web browser). See the Acrobat JavaScript documentation (which is part of the Acrobat SDK, downloadable from the Adobe website).
To 2): The answer is simple: no. This is not allowed (and implemented) for security reasons.
Hope this can help.
Max Wyss.

Disable Printing in a PDF Viewer ActiveX control?

I'm using the Adobe Acrobat PDF Viewer ActiveX (AxAcroPDFLib.AxAcroPDF) control in one of my forms to display Controlled Document PDFs and my customer would like end users to not be able to print these documents. Is there anyway to disable printing through this control?
The PDF format supports permissions and "allow printing" is one of the permissions. If you can control the PDF generation of these controlled PDFs your best bet is to disable the allow print permission for users. You can also even run existing PDFs through a conversion process to add the necessary permissions with iText, ghostscript or something similar.
Besides, even if you are able to to disable the print button on the ActiveX viewer, if the user is clever enough to realize it is merely a PDF, they could just download the PDF and print it normally.
There's a new PDF software that does this by default. You would have to save the document as .wwf rather than .pdf. If the document is already in PDF format you can re-save it in WWF format.
It's provided by the World Wildlife Foundation in an effort to reduce paper use. The end user does not need to have the software installed on their computer for it to work. You can download the software for both MAC or PC from the link below. Hope this helps!
http://www.saveaswwf.com/en/

difference between microsoft report viewer and adobe pdf reader tools?

i would like to display a pdf on my winform and am thinking of using of those tools in my vb.net application. does anyone know the difference between the two?
Microsoft Report Viewer reads report definition files and displays the report. Adobe's PDF reader displays PDF files.
Report definition files != PDF files, so you would need to make sure that you use the right tool for the right job. If you need to read PDFs, use a PDF reader.
As for consuming a PDF on a WinForm, you could host a WebBrowser control and point to the PDF. Alternately, there are several WinForm control manufacturers that read and display a PDF file (though I've not used any of them so would not be able to recommend one over another). Examples would be:
http://www.tallcomponents.com/
http://www.skysof.com/