PdfiumViewer Pdfium Exception - VS2017 Created Project must be .Net 4.0 and then upgrade to any higher versions

0

VS2017 ver 15.9.3

NuGet Packages PdfiumViewer version="2.13.0.0"

PdfiumViewer.Native.x86_64.v8-xfa version="2018.4.8.256"

Test Scenario - Load PDF file with PdfiumViewer

  1. Create Project1: Target Framework = .Net Framework 4. Program runs successfully.
  2. Change Project1 to any higher Framework - 4.5, 4.5, 4.6 ... 4.72 Program runs successfully

3. Create Project2: Target Framework = .Net Framework 4.7.2 or any other FW 4.5, 4.5, 4.6 ( ** NOT FW 4 ).
Error Message: $exception {"An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"} System.BadImageFormatException

  1. Change Project2 to FW = 4. Program runs successfully.
  2. Change Project2 to any higher Framework - 4.5, 4.5, 4.6 ... 4.72 Program runs successfully

Code

Error Message: $exception {"An attempt was made to load a program with an incorrect format. (Exception from 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);
     }
  }

==============

Help is appreciated.

c#
pdf
rendering
pdf-viewer
pdfium
asked on Stack Overflow Mar 1, 2019 by G. Young • edited Mar 2, 2019 by G. Young

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0