Spire.PDFViewer is a powerful PDF Viewer component for .NET. It allows developers to load PDF document from stream, file and byte array.

Wed Jun 19, 2024 7:59 am

Hi,

I added Spire.PDF Viewer to my project via NuGet, and it worked fine. Then I realized that the free version suffices, so I uninstalled Spire via NuGet. However, when I installed FreeSpire.PDFViewer and added the PDFViewer control to the form, I encountered the following error when I ran my project:

Code: Select all
System.IO.FileLoadException
  HResult=0x80131040
  Nachricht = Die Datei oder Assembly "Spire.Pdf, Version=10.2.0.0, Culture=neutral, PublicKeyToken=663f351905198cb3" oder eine Abhängigkeit davon wurde nicht gefunden. Die gefundene Manifestdefinition der Assembly stimmt nicht mit dem Assemblyverweis überein. (Ausnahme von HRESULT: 0x80131040)
  Quelle = <Die Ausnahmequelle kann nicht ausgewertet werden.>
  Stapelüberwachung:
<Die Ausnahmestapelüberwachung kann nicht ausgewertet werden.>

Innere Ausnahme 1:
FileLoadException: Die Datei oder Assembly "Spire.Pdf, Version=8.6.0.0, Culture=neutral, PublicKeyToken=663f351905198cb3" oder eine Abhängigkeit davon wurde nicht gefunden. Die gefundene Manifestdefinition der Assembly stimmt nicht mit dem Assemblyverweis überein. (Ausnahme von HRESULT: 0x80131040)


Thanks for any suggestions!

FoChrist
 
Posts: 3
Joined: Wed Jun 19, 2024 7:48 am

Wed Jun 19, 2024 8:52 am

Hello,

Thanks for your inquiry.
Does your project reference multiple dll files about Spire? If so, it may cause version conflicts. Regarding your issue, we recommend you remove all dll files about Spire in your project first, and then re-add Spire.Pdf Viewer to your project. If you want to use multiple products at the same time, please install Spire.Office directly. If you have any other questions, please feel free to write back.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 453
Joined: Mon Dec 27, 2021 2:23 am

Wed Jun 26, 2024 5:11 am

Hi William,

Thanks for your answer. I have only installed FreeSpire.PDFViewer (v 7.6.0) via NuGet in my project. Multiple Versions are not needed.

When I look in the binding window, I see the following bindings:
Spire.Pdf 8.6.0.0 ...project\packages\FreeSpire.PDFViewer.7.6.0\lib\net46\Spire.PdfViewer.Forms.dll
Spire.PdfViewer.Asp 7.6.0.0 ...project\packages\FreeSpire.PDFViewer.7.6.0\lib\net46\Spire.PdfViewer.Asp.dll
Spire.PdfViewer.Forms 7.6.0.0 ...project\packages\FreeSpire.PDFViewer.7.6.0\lib\net46\Spire.PdfViewer.Asp.dll

Edit:
I found the problem. The app.config file was the issue. If I comment out the Spire section, the form runs. Is a Spire entry needed in the app.config file?

Code: Select all
<configuration>
    <configSections>
    </configSections>
    <connectionStrings>
        <add name="name" connectionString="Data Source=sourece"/>
        <add name="name.My.MySettings.NameConnectionString" connectionString="name"/>
    </connectionStrings>
    <startup>
       
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1"/></startup>
  <runtime>
    <!--<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Spire.Pdf" publicKeyToken="663f351905198cb3" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-10.2.0.0" newVersion="10.2.0.0"/>
      </dependentAssembly>
    </assemblyBinding>-->
  </runtime>
</configuration>

FoChrist
 
Posts: 3
Joined: Wed Jun 19, 2024 7:48 am

Wed Jun 26, 2024 7:07 am

Hello,

Thanks for your reply.
We speculate that you have previously installed Spire.PDF in your project. If you only use Spire.PDFViewer, you do need to comment out the configuration you mentioned.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 453
Joined: Mon Dec 27, 2021 2:23 am

Thu Jun 27, 2024 7:23 am

Hi William,

thanks for your help. I have another question. Can i set the zoom mode after loadFromFile to fitwith by code?

FoChrist
 
Posts: 3
Joined: Wed Jun 19, 2024 7:48 am

Fri Jun 28, 2024 7:11 am

Hello,

Thanks for your inquiry.
Please use the following code to achieve your needs. If you have any other questions, please fell free to write back.
Code: Select all
 this.pdfdocumentViewer1.zoommode = zoommode.fitWidth;


Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 453
Joined: Mon Dec 27, 2021 2:23 am

Return to Spire.PDFViewer

cron