我正在尝试转换一个pdf到word,并保存它通过api编程。通过更改其他引用中的代码,我已经在C# samples文件夹中尝试了sdk中给出的示例。然而,我得到了反射错误,因为‘目标类型不匹配’。以下是我的代码
AcroPDDoc pdfd = new AcroPDDoc();
pdfd.Open(filename);[enter image description here][1]
Object jsObj = pdfd.GetJSObject();
Type jsType = pdfd.GetType();
//have to use acrobat javascript api because, acrobat
object[] saveAsParam = { "newFile.docx", "com.adobe.acrobat.docx", "",
false, false };
jsType.InvokeMember("saveAs", BindingFlags.InvokeMethod |
BindingFlags.Public | BindingFlags.Instance, null, jsObj, saveAsParam,
CultureInfo.InvariantCulture);将打开一个对话框,并选择要转换的文件。到目前为止,我知道这是many.What的工作代码,我是否做错了.Please帮助。我在我的system.This上安装了Acrobat DC,这是我的版本
版本: Adobe Acrobat Pro DC 2017.009.20044
发布于 2018-10-12 14:41:11
使用C#将PDF转换为Word (.docx):
AcroPDDoc() pdfDoc = new AcroPDDoc();
if (pdfDoc.Open(sourceFileName))
{
Object jsObj = pdfDoc.GetJSObject();
Type type = jsObj.GetType();
object[] saveAsParam = { convertedFilePath, "com.adobe.acrobat.docx" };
type.InvokeMember(
"saveAs",
BindingFlags.InvokeMethod |
BindingFlags.Public |
BindingFlags.Instance,
null, jsObj, saveAsParam);
}https://stackoverflow.com/questions/43874778
复制相似问题