C# 另存为:无效的PDF文件格式
我正在使用easyPDF 7 我跟着导游走。当我尝试编辑一个字段然后保存时,会出现以下错误:C# 另存为:无效的PDF文件格式,c#,.net,pdf,C#,.net,Pdf,我正在使用easyPDF 7 我跟着导游走。当我尝试编辑一个字段然后保存时,会出现以下错误: "SaveAs: Invalid PDF file format" 如果我不尝试编辑字段,我可以毫无错误地调用SaveAs方法 这是我的密码 Type type = Type.GetTypeFromProgID("easyPDF.Loader.7"); Loader oLoader = (Loader)Activator.CreateInstance(type); PDFDocument oDocu
"SaveAs: Invalid PDF file format"
如果我不尝试编辑字段,我可以毫无错误地调用SaveAs方法
这是我的密码
Type type = Type.GetTypeFromProgID("easyPDF.Loader.7");
Loader oLoader = (Loader)Activator.CreateInstance(type);
PDFDocument oDocument = (PDFDocument)oLoader.LoadObject("easyPDF.PDFDocument.7");
oDocument.Open("C:/Acrobat Document.pdf");
FormFields oFormFields = oDocument.FormFields;
FormField oFormField = oFormFields[0];
TextField oTextField;
oDocument.SaveAs("C:/Acrobat Document.pdf"); //this save works
if (oFormField.Type == docFormFieldType.DOC_FRMTYPE_TEXT)
{
oTextField = (TextField)oFormField;
oTextField.Value = "BCL Technologies";//if I comment this line out I dont get the error
}
oDocument.SaveAs("C:/Acrobat Document.pdf");//this save throws error:SaveAs: Invalid PDF file format
尝试注释掉第一个oDocument.OpenC:/Acrobat Document.pdf;。错误仍然存在吗?@HamletHakobyan如果他不打开文件,就没有什么可保存的了!ups,对不起,我指的是第一份OdoDocument.SaveAsC:/Acrobat Document.pdf@删除第一个SaveAs不会修复错误。Otext字段中的实际数据是什么?