Search code examples
asp.net-mvc.net-assemblymvcrazortopdf

MvcRazorToPdf installation issues


I am trying to check out MvcRazorToPdf. I'm installing it from Nuget Manager. When I attempt to build the project I get this error message:

Error 5 Assembly 'MvcRazorToPdf, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'itextsharp, Version=5.5.3.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca' which has a higher version than referenced assembly 'itextsharp, Version=5.5.0.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca' d:\PROJECTS\Crowdiet\packages\MvcRazorToPdf.1.0.2\lib\40\MvcRazorToPdf.dll Crowdiet

In order to solve it I installed the latest version of iTextSharp from Nuget. Version 5.5.7 Now I'm building and so it runs.

However, when trying to execute MvcRazorToPdf code I get the following error message:

Could not load file or assembly 'itextsharp.xmlworker, Version=5.5.3.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'itextsharp.xmlworker, Version=5.5.3.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Any ideas how to deal with this? Thanks.


Solution

  • DSB I've written this as theres too much to place in a comment.

    This link should help address your azure query SO.

    In regards to what I had said about updating your wkhtml files you need to click this link wkhtml download (this is a link for the site wkhtml page) as this will provide you with the 3 updated files you need for rotativa. There's 2 things that you can do when the download has finished in order to get these new files into your solution. This download will save a setup program to your computer which contains the 3 files. When you are saving the files make a note of where you are saving them to.

    1. Download 7 zip found at 7zip or any file extracting tool if you don't already have one. Right click on your download and use the extraction tool to extract and save the 3 updated files.

      1. If you can't download or don't have an extraction tool then run the setup of the downloaded file. This should save into your program files in your standard drive. Navigate through program files to the wkhtmltopdf folder, click on it, then click the bin folder and inside this you'll find the 3 updated wkhtml files.

    When you've got these three files add these to your existing rotativa folder inside your solution. Do a rebuild of the soultion if necessary just to update it. Hope this helps!!