English 中文(简体)
How to add PDFsharp lib in C#?
原标题:

I am new to C#.net, I downloaded PDFsharp lib. But how to add this lib to our project?
My project is to create a PDF file. Please provide me step by step instructions. After unziping it has 32 folders.
I tried by coping it in my project folder, but same errors come.

"The type or namespace name PdfSharp could not be found (are you missing a using directive or an assembly reference?)"

最佳回答

If you wish to use this library you need to add a reference to the assembly (dll) that contains the library. To add references simply right click on your project in solution explorer and select add reference, you will then have a tabbed dialog box that allows you to add references to dlls in the GAC, other projects in your solution or browse to dlls located anywhere on your PC.

All the folders you see are the source code and sample projects that show you how to use the library. If you open the "BuildAll-PdfSharp.sln" which is contained in the root of the code directory you will be able to build PDFSharp and get the dll. It will be in the folder user code PdfSharpin

Once you have the dll you can add it to your solution by browsing to the location of the dll on disc. When I add third party libraries to my project I have a lib folder at the root of my working folder where all the dlls are placed. References to these in the project files then use relative paths and will be available to anyone else working on the project when they get the latest from your source repository.

问题回答

I ve also found that PdfSharp is available as an add on through the Nuget Package Manager Console.

You can add the existing projects (*.csproj) that come with the PDFsharp source code to your solution and then reference these projects. If you do so, you can jump into the PDFsharp source code and IntelliSense will also work. Check the samples to see which references you need.

All required assemblies will automatically be copied to the bin/debug or bin/release folder respectively of your application.

If you only downloaded the binaries, add references to the DLL files.

Update: You can find PDFsharp and MigraDoc on NuGet. The NuGet Package Manager will then add the project references for you.

Download the Assemblies version from this URL: http://pdfsharp.codeplex.com/releases/view/37054

I think you have downloaded the source files. Open the file BuildAll-PdfSharp.sln in visual studio and build the project. Then it will generate the dll files that you have to reference in your own project.

Hope this helps.

/Klaus

you have to add the dll as a reference to your Visual Studio solution. In the project explorer, in the Reference node, right click and add reference. Search for that dll and add it to the project.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签