I'm trying to export data from a gridview to PDF file. Do I need to download
iTextSharp.dll and where should I put that file in? Is there a good example for it? Thanks.
I downloaded the itextsharp.dll and placed it in the bin folder. I right click on References to add the dll but cannot find the itextsharp.dll in the list of references.
I get compilation error because it doesn't know about itextsharp.
I had that and they had error because I couldn't add a reference to iTextSharp. I found a way to add the reference by selecting the iTextSharp.dll from my hard drive instead of from .Net and that works.
When I use:
Table a =
new Table();
I get compilation error about 'Table' is an ambiguous reference between 'System.Web.UI.WebControls.Table' and 'iTextSharp.text.Table'.
or whichever one you want it to be. Or, if you are not using any WebControls on the page, remove the "using System.Web.UI.WebControls;" statement from the page.
pinky8
Participant
774 Points
1070 Posts
export to PDF file
Jul 07, 2008 06:34 PM|LINK
I'm trying to export data from a gridview to PDF file. Do I need to download iTextSharp.dll and where should I put that file in? Is there a good example for it? Thanks.
Mikesdotnett...
All-Star
154931 Points
19870 Posts
Moderator
MVP
Re: export to PDF file
Jul 07, 2008 07:17 PM|LINK
You certainly need to install some PDF component or another. Put the dll in the bin folder and have a look at these tutorials: http://itextsharp.sourceforge.net/tutorial/index.html
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
gunteman
All-Star
22406 Points
3305 Posts
Re: export to PDF file
Jul 07, 2008 07:18 PM|LINK
Well, iTextSharp is free and cool, but there are certainly better commercial alternatives.
But if it's enough for you, have a look at:
http://forums.asp.net/p/1269531/2395539.aspx
pinky8
Participant
774 Points
1070 Posts
Re: export to PDF file
Jul 07, 2008 07:30 PM|LINK
I downloaded the itextsharp.dll and placed it in the bin folder. I right click on References to add the dll but cannot find the itextsharp.dll in the list of references.
I get compilation error because it doesn't know about itextsharp.
Mikesdotnett...
All-Star
154931 Points
19870 Posts
Moderator
MVP
Re: export to PDF file
Jul 07, 2008 07:45 PM|LINK
In your code-behind, try just adding:
using iTextSharp.text;
using iTextSharp.text.pdf;
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
pinky8
Participant
774 Points
1070 Posts
Re: export to PDF file
Jul 08, 2008 12:34 PM|LINK
I had that and they had error because I couldn't add a reference to iTextSharp. I found a way to add the reference by selecting the iTextSharp.dll from my hard drive instead of from .Net and that works.
When I use:
Table a = new Table();
I get compilation error about 'Table' is an ambiguous reference between 'System.Web.UI.WebControls.Table' and 'iTextSharp.text.Table'.
Mikesdotnett...
All-Star
154931 Points
19870 Posts
Moderator
MVP
Re: export to PDF file
Jul 08, 2008 04:06 PM|LINK
Change it so there is no ambiguity:
Table a = new iTextSharp.Text.Table();
or whichever one you want it to be. Or, if you are not using any WebControls on the page, remove the "using System.Web.UI.WebControls;" statement from the page.
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
pinky8
Participant
774 Points
1070 Posts
Re: export to PDF file
Jul 08, 2008 06:42 PM|LINK
Thank you both.