Search code examples
asp.netc#-4.0pdfbrowserrequest.form

Request.Form using in my application Firefox get the values in pdf file but Chrome browser pass the null value


I developed one project using editable pdf files in browser fill the pdf file and save the file to local system see this my post save the pdf file, answer is working in Firefox browser(10.0) but it not supported in Google Chrome(problem is MYVal value always pass null but Firefox passes the correct values. I think Request.Form does not support please give me any suggestion about that )

FileInfo fi = new FileInfo(Server.MapPath("~/PDFFiles/" + file.Trim() + ""));
Stamper = new PdfStamper(pdfReader, new FileStream(
                                   newFile, FileMode.Create));
                        // Get the pdf fields to acrofields
                        AcroFields pdfFormFields = pdfStamper.AcroFields;
                        //check the templete pdf fields and browser u entered value fields it is matching to store the values
                        foreach (DictionaryEntry de in pdfReader.AcroFields.Fields)
                        {
                            //field value to store the MyVal string
                            string MyVal = Request.Form[de.Key.ToString()];
                            //check the value is null or not
                            if (MyVal != null)
                            {
                                //to store the values to new created pdf file
                                pdfFormFields.SetField(de.Key.ToString(), MyVal);
                            }
                        }
                        // report by reading values from completed PDF
                        string sTmp = "the pdf form created successfully";
                        showalert(sTmp);

and another problem is open the editable pdf files in browser my code is

 <asp:HyperLink ID="HyperLink1" runat="server" 
        NavigateUrl="~/PDFFiles/AGENCY PROFILE APP.pdf">Agency profile app</asp:HyperLink>
        <br />
        <br />
           <asp:HyperLink ID="HyperLink2" runat="server" 
        NavigateUrl="~/PDFFiles/CL_Animal_Grooming_Vet.pdf">CL_Animal_Grooming_vet</asp:HyperLink>
        <br />

above code open the pdf files in browser Firfox(10.0) is working properlly but previous versions in Firefox and Chrome and IE also click the link display the open and save dialogue box but I have open the browser in pdf file and enter the data please give any idea about that it is very urgent please.


Solution

    1. Type "chrome://plugins" in the address bar (without the quotes)
    2. Hit enter
    3. Click on details (near the top right)
    4. Disable "Chrome PDF Viewer" and enable the Adobe one

    Must Install the Adobe Reader..