Library dependencies for pdfiumViewer? - c#

i got some troubles to display a pdf using pdfium using c#. I read this other question:
Read a stored PDF from memory stream
i downloaded the pdfiumViewer package, but when i compile it, it says that it can't find the pdfium library. So, I downloaded the package "pdfium.net SDK" so it's working but it's not free, it's limited version. what i was wondering is : do we must have the package "pdfium.net SDK" to have the "pdfiumViewer" working" ?
thx !

The SDK you found, which I guess is Patagames's Pdfium.Net SDK, which is indeed a paid solution.
PdfiumViewer is free, but you have to have pdfium built, which is pretty thoroughly documented.

Pdfium.dll is already integrated into PdfiumViewer. But for it to be loaded, you need when building your project, to copy this file next to your application, either in the root or the x86 or x64 sub directory. The easiest way to accomplish this is by changing the properties of that file, changing the Copy to Output Directory setting to Copy always.

Try the NuGet package "PdfiumViewer". Works like a charm!
In my case*, I needed the NuGet Package PdfiumViewer.Native.x86.v8-xfa, which adds the needed DLL.
Got it running after 10 minutes with this code.
*) Visual Studio 2019 Pro, Windows 10 x64 Pro

Related

Setup FFMpegCore in Visual Studio 2019

I am confused on the basics of using a library. I understand that there is a library called FFMpeg and a wrapper called FFMpegCore so we can use FFMpeg with C#, correct? I downloaded both FFMpeg and FFMpegCore and I have them in my project's folder. Although I didn't perceive any class named FFMpegOptions in either of the file's folders.
I am stuck on how to actually set it up so I can use it in my little project, I never downloaded someone's library before. Can somebody please walk me though the motions of connecting the three of them together?
So far I experimented with:
Add a reference to my project, but there doesn't seem to be any .dll, .tlb, .olb, .ocx or .exe files to add
Add an existing project to my solution. There is a project called FFMpegCore.csproj but adding it raises a missing SDK error. Weirdly enough, opening the same project as a standalone doesn't raise any issues which makes me thing the operation I am trying is inadequate.
I am sure this is a silly and easy setup to perform but I just don't know enough to find a solution.
First you must download and install ffmpeg on your machine, (to test that it is working correctly, open a CMD and execute "ffmpeg", it will return the installed version.
Second, create a new project, (I recommend .NETFramework) once your project is created, it is necessary to install the package from NuGet, this function is found in tools> NuGet Package Manager> Manage packages for solutions...>
Then search for FFmpegCore and install it in your project,
The necessary dependencies will be added, now you can start programming with this Framework,
I recommend the FFMpeg.cs class as an example of the documentation, to start with.
Good Luck.

SDK Rich Presence Discrod С# | Can't figure out how to create rich presence via SDK Discord

I am trying to install the Discord SDK for my C # console project for the sake of a test, but I am failing.
I have very little interaction with Visual Studio, with which I write the code, so please help with installing the SDK. I try to do everything according to what was said below, but perhaps I do not fully understand the sequence:
Open up that SDK zip that you downloaded.
Create a folder in your project directory called DiscordGameSDK and
copy the contents of the csharp/ folder to it
Build your solution then place the .dll in the directory of the .exe
(either x86 or x86_64 version depending on your compile platform).
If you compile for Any CPU you may need to perform additional
wrapping around DLL importing (like setting the DLL directory
dynamically) to make sure you load the correct DLL.
https://discord.com/developers/docs/game-sdk/sdk-starter-guide
I don't quite understand the third line of actions related to the solution, dll and exe files
Thanks in advance!
Since I'm writing in VS Code, I created a Discord Game SDK folder in my console project and moved all the files from the csharp folder to the DiscordGameSDK folder. After that, I compiled the project and transferred all the files from the lib folder to the bin/Debug/net6.0 folder
Visual Studio should work the same way. (Not sure)
enter image description here

Visual Studio Code : The 'C#' extension is recommended for this file type

So I recently installed visual studio code and added the C# available extensions. I also installed the Unity Debugger but it won't work because "it depends on an unknown 'ms-vscode.csharp' extension", I tried searching for this 'ms-vscode.csharp'in the extensions bar but found nothing. whenever i open a C# file from Unity or from any folder it recommends me to install that uknown C# extensions. what can i do please? here is a picture of the message:
To manually install the correct c# extension, do the following:
Uninstall existing vscode C# plugin
Close vscode
Download the vsix 1.21.12 from here
Open a command line in the folder where the vsix is.
Type: code --install-extension .\csharp-1.21.12.vsix
You should see:
Installing extensions...
Extension 'csharp-1.21.12.vsix' was successfully installed.
Open VSCode and in the C# output window, you will see:
Installing C# dependencies...
Platform: win32, x86_64
Downloading package 'OmniSharp for Windows (.NET 4.6 / x64)' (32544 KB).................... Done!
Validating download...
Integrity Check succeeded.
Installing package 'OmniSharp for Windows (.NET 4.6 / x64)'
Errors should now have gone away.
That was a mistake by Microsoft. I just spent hours to solve the problem and noticed that actually the name of the plugin was recently changed, leading to the error. We can fix it by manually downloading a previous version of the plugin.
Link:https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp&ssr=false#review-details
I don't do Unity development, but this may help: https://code.visualstudio.com/docs/other/unity
Keep in mind that VSCode is only going to be an editor for your project files.
(Can't comment, apologies for the brief answer)
I delete [.vscode\extensions], swith to 1.21.1/February 2018 and then update to 1.42.1. It finally works fine!
Maybe System setup doesn't have the problem. It only occurs on User setup.
That error happens because microsoft changed marketplace publisher from ms-vscode to ms-dotnettools. Mentioned here on github. You can just install the version v1.21.18 and that should solve it.

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
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!
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:
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.

Tesseract.NET in C#

Do you know of step by step guide of how to use bins and dlls in http://www.pixel-technology.com/freeware/tessnet2/
I spent 2 days trying to use this by when compiling i am being asked for a dll that do not exist in the zip file i downloaded from the site.
Any help will be greatly appreciated.
You need the Leptonica DLL for Windows. You can download it from http://www.leptonica.com/download.html, or direct link to the specific zip is here. You need to copy the lib & include folders into the Google Tesseract vs2008 folder (ie, create vs2008\lib and vs2008\include).
download the binaries here: http://www.pixel-technology.com/freeware/tessnet2/bin.zip
select the project and rightclick in the project explorer → Add reference → Browse...
select the dll version that is compatible with your build settings (x86 or x64) see the properties of your project
do a rebuild
Remove all installations of the tesseract bins from 3.0 also cleanup your registry (took me hours to find this one out).
VietOCR.NET is a working program of tessnet2 library. It is an open-source application.

Categories