我在浏览器中使用可编辑的 pdf 文件开发了一个项目,填充 pdf 文件并将文件保存到本地系统,请参阅我的帖子保存 pdf 文件,答案在Firefox 浏览器(10.0)中有效,但 Google Chrome 不支持(问题是 MYVal value 总是传递 null 但 Firefox 传递正确的值。我认为 Request.Form 不支持请给我任何建议)
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);
另一个问题是在浏览器中打开可编辑的pdf文件我的代码是
<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 />
上面的代码在浏览器中打开 pdf 文件 Firfox(10.0) 工作正常,但 Firefox 和 Chrome 和 IE 中的早期版本也单击链接显示打开和保存对话框,但我已经在 pdf 文件中打开浏览器并输入数据请给出请对此有任何想法。