[英]PdfiumViewer Pdfium Exception - VS2017 Created Project must be .Net 4.0 and then upgrade to any higher versions
VS2017 版本 15.9.3
NuGet 包 PdfiumViewer 版本="2.13.0.0"
PdfiumViewer.Native.x86_64.v8-xfa version="2018.4.8.256"
3. 創建 Project2:目標框架 = .Net Framework 4.7.2 或任何其他 FW 4.5、4.5、4.6(** 不是 FW 4)。
錯誤消息:$exception {“嘗試加載格式不正確的程序。(來自 HRESULT 的異常:0x8007000B)”} System.BadImageFormatException
錯誤消息:$exception {“嘗試加載格式不正確的程序。(來自 HRESULT 的異常:0x8007000B)”} System.BadImageFormatException
private void button1_Click(object sender, EventArgs e)
{
string pdf = @"D:\PDF\TestFile.pdf";
try
{
var document = PdfiumViewer.PdfDocument.Load(pdf); // *** Exception ***
MessageBox.Show("OK");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
==============
幫助表示贊賞。
將包含pdfium.dll的x86和x64文件夾添加到 Debug/Release 目錄,應該是這樣。 如果您不知道在哪里可以找到它們,請從PdfiumViewer Github運行PdfiumViewer.Demo項目,您將在bin文件夾中找到它們。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.