setting to force a form to download
Copy link to clipboard
Copied
I have a form that will be stored in a document repository and downloaded as needed for use. It may also be emailed. In testing, when the form is emailed, the file can be opened in the browser and appears the fields can be filled in. The problem is some of the properties do not work. For example, mandatory fields are no longer mandatory; the calendar fields do not display a calendar; calendar fields date changes from date entered to system date (this one is very strange); and the file loses all data entered (when entered using the browser) when saved.
Is there a way or a setting that prevents data from being entered when the form is opened in a browser? Ideally, would like a message to pop up and something like "must use Reader to complete this form".
Copy link to clipboard
Copied
Unfortunately not all web browsers, mobile apps, and PDF viewers can process forms created by Acrobat or other programs that can create PDF forms. Also one cannot always detect these products are being used. One approach is to include a visible field with a warning about using a non-Adobe product or a product that cannot process PDF forms and then by using a document level script or page open script one can hide this visible form field.
Copy link to clipboard
Copied
I would recommend sending the file inside a zip archive. That would force the users to download it before opening it... Not ideal, but it will help avoid it being opened in the browser.
Copy link to clipboard
Copied
You can force the download of all PDF files (not only forms) from a Web site by modifying the .htaccess file as explained in this tutorial: https://www.abracadabrapdf.net/ressources-et-tutos/creation/forcer-telechargement-pdf/
Since I use a nice French language most web translators should gives a good result in any language, in any case you will find the line to add to your .htaccess file.
Acrobate du PDF, InDesigner et Photoshopographe
Copy link to clipboard
Copied
Forcing the download of a PDF does not guarantee that it will not open in a low-end software that does not support AcroForm and JavaScript.
So, to force the opening of a form with Acrobat Reader you should read this tutorial too: https://www.abracadabrapdf.net/ressources-et-tutos/js-et-formulaires-ressources/forcer-utilisation-p...
Acrobate du PDF, InDesigner et Photoshopographe
Copy link to clipboard
Copied
Forcing a file to download from a URL is done with a server-side script; such as PHP or ASP.net:
ASP.net: Example
/// <summary>
/// Forces download of file
/// </summary>
/// <param name="FileBytes">Byte array of file</param>
/// <param name="FileName">File name</param>
/// <returns>true/false</returns>
/// <remarks></remarks>
public bool ForceDownload(byte[] FileBytes, string DownloadFileName)
{
try {
if (string.IsNullOrEmpty(DownloadFileName)) {
return false;
}
if (FileBytes.Length > 0) {
Response.Clear();
//AspxPage.Response.ContentType = "application/octet-stream";
Response.ContentType = "application/pdf";
Response.AppendHeader("Content-Disposition", "attachment; filename=\"" + DownloadFileName + "\"");
Response.BinaryWrite(FileBytes);
HttpContext.Current.ApplicationInstance.CompleteRequest();
Response.End();
return true;
}
} catch (Exception ex) {
return true;
}
return false;
}

