我在VS2008的C#项目中使用了Debenu PDFViewer。我想将附件保存到磁盘上。尽管附件文件已经被保存,但方法的返回值为0(表示失败)。保存的文件无法在Adobe Reader中打开,并弹出如上图所示的提示信息。
以下是我的代码,用于加载PDF文件并保存附件文件。
以下是我的代码,用于加载PDF文件并保存附件文件。
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
axDPVActiveX1.OpenFile(openFileDialog1.FileName);
for (int i = 1; i <= axDPVActiveX1.DQPLEmbeddedFileCount(); i++)
{
if (axDPVActiveX1.DQPLGetEmbeddedFileStrProperty(i, 5).Contains(".pdf"))
{
if (axDPVActiveX1.DQPLGetEmbeddedFileContentToFile(i, @"C:\Users\userName\Desktop\Test folder\" + axDPVActiveX1.DQPLGetEmbeddedFileStrProperty(i, 5) == 1)
{
MessageBox.Show("Done!");
}
else
{
MessageBox.Show("Failed!");
}
MessageBox.Show(axDPVActiveX1.DQPLGetEmbeddedFileContentToString(i));
}
}
}
Would someone show me how to fix it. Thanks in advance.