To display a pdf document with ASP.net here are some useful articles......
This code shows you how to create and bind a DataSet and a Crystal Report file (.rpt) without even using Visual Studio at all (I used Web Matrix). It is assumed, however, that you have access to the Crystal Reports .dlls which came with Visual Studio .NET and that you have the ability to create .rpt files (I used Crystal Reports 9.0).
====================================================================
This following article describes how to embed and display PDF documents in a webpage using simple ASP.NET custom server control. The method used, allows the developer to control the web page contents surrounding the embedded PDF.
This is not same as linking directly to a PDF which doesn't allow developer to control the appearance of the page.
There are two Visual Studio .NET solutions included with this download, one is web custom control library containing a single custom control used to render out the PDF, and the other is a test web site used to display a PDF through the use of the control.
Figure 3 (below) shows the solution explorer for the project. The project appearing at the top of the solution is the test web site, it contains only a single web page (default) and it includes a PDF file included for testing purposes. The bottom project is the web custom control library with the single control included (ShowPdf). The references in the test web site are per the default configuration; the custom control library references include the default references but also include System.Design namespace.
First of all I create a simple "Hello PDF". Next I will create a more complex PDF document with tables. To start creating PDF documents you need to download the itextsharp library from http://sourceforge.net/projects/itextsharp/ and reference it in your project. The PDF documents are created "on the fly" by the web page "ShowPDF.aspx". This page does also a "Response.Redirect" to the created PDF. First import some required Namespaces:
Imports System
Imports System.IO
Imports iTextSharp.text
Imports iTextSharp.text.pdf
Next I decide in the Page_Load event which document was requested by the user: Details
No comments:
Post a Comment