'Adding pdfium.dll to visual studio
For the application that I am making, I need to make use of the Pdfiumviewer package, which in turn requires you to add Pdfium itself, which is made available by Google. There is a "tutorial" on how to add pdfium on the official site but I haven't been able to decipher what exactly it is that I need to do.
At first glance, it appeared that you can get Pdfium via de Nuget Package Manager but it quickly became apparent that nuget doesn't add the actual dll to the project, and simply adding it as a reference doesn't work either. (throws 'reference could not be added' error). After this, I attempted to move the Pdfium dll to the bin/debug folder, but that still gives the same error. After doing some research, I found out that this dll is not supported by visual studio and you have to build/integrate it using the command line.
There are instructions on how to achieve this provided on https://pdfium.googlesource.com/pdfium/ https://github.com/pvginkel/PdfiumViewer/wiki/Building-PDFium
but after a few days of reading into it, I still have no clue what exactly I should and shouldn't do in the tutorial provided by google.
Therefor, I would like to kindly ask if anyone is either able to explain in plain english how to run through these steps, or if anyone knows a more user friendly tutorial to follow.
Many thanks in advance! ~Melvin
Solution 1:[1]
I assume you're using Winforms?
To get the pdfRenderer control in a WinForm: Add the PdfiumViewer
NuGet package to the project; open the projects packages folder in Windows Explorer and drag the PdfiumViewer.dll
file onto the Toolbox
window; A control called PdfRenderer
will be available to add:
Solution 2:[2]
In case anyone still needs help with this, I was having the same problem and solved it using @Jack 's comment on @Paddy 's solution:
- Install
PdfiumViewer
NuGet package - Install
PdfiumViewer.Native.x86.v8-xfa
NuGet package - Install
PdfiumViewer.Native.x86_64.v8-xfa
NuGet package
After installing all 3 packages, I published the application (my application is ClickOnce) and executed it, and it worked just fine!
Solution 3:[3]
I had tremendous grief with this missing dll, until I found the easiest way I found was to go to Nuget Package Manager and install the PDFium.Windows package.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Morphed |
Solution 2 | |
Solution 3 | Rafael Ventura |