user2830487
user2830487

Reputation: 11

How to generate pdf file on button click?

I'am using visual studio 2008. I wants to generate pdf file on button click. I have used

using iTextSharp.text;
using iTextSharp.text.pdf;  

but it shows an error

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

from searching I have found that , need to add a source assembly (iTextSharp.dll) . How will it possible?

Upvotes: 0

Views: 2048

Answers (4)

Sudhakar Tillapudi
Sudhakar Tillapudi

Reputation: 26209

Reason for failure:

you did not add ItextSharp.DLL as reference to your project. untill unless you add this dll to you project you can not use the classes from ITextSharp Library.

Solution: you need to download ItextSharp.DLL and Add that dll as reference to your Projet.

Step 1: : Download ItextSharp.DLL from below Link. http://sourceforge.net/projects/itextsharp/

Step 2: right click on Project Select -> Add Reference

Step 3: Select ItextSharp.Dll from your downloaded location.

Step 4: Now Rebuild the project.

Upvotes: 0

CodeCaster
CodeCaster

Reputation: 151594

You can install it through NuGet.

Upvotes: 1

Iti Tyagi
Iti Tyagi

Reputation: 3661

You need to download this dll. So download and then add a reference in your project and then you can use the same. Like Right click on the Project > Add Reference >

1) A new window will open and you can add the file.

2) Build and it should work.

Upvotes: 0

germi
germi

Reputation: 4658

Edit: This is unneccessarily complicated. As CodeCaster points out in his comment, you can just use NuGet to install iTextSharp. I'd recommend you try that.

You need to download the iTextSharp library: http://sourceforge.net/projects/itextsharp/ and reference that .dll in VS. Your download will be a zip file with multiple other archives in it. From those, chose itextsharp-dll-core.zip and extract it.

Then you go into Visual Studio, right click your project and chose "Add reference...". In the following dialog you select the dll. Now you can use using iTextSharp;.

Upvotes: 1

Related Questions