CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2005
    Posts
    175

    Question How to Create PDF document in ASP.NET

    Hi experts,
    I m new to ASP.NET. and using vb.net as a source code. I m working on a very small project. I need to fetch the data from database and based on the data in reader, I need to generate PDF documents. e.g. I have a database where students marks are stored as below.

    Std name sub1 sub2 sub3 sub4
    -------------------------------------------------------------
    Some name1 40 41 35 45
    Some name2 30 45 15 49


    I want when user clicks on a button go generate mark sheets, one PDF file of two pages (since only two records in database) will be generated as below:

    Name : Some Name1
    -------------------------------
    Subjects Marks
    sub1 40
    sub2 41
    sub3 35
    sub4 45
    ----------------------------------
    Total 161

    and one more and same page for some name2, so that when print command is given user can print all or selected pages from the pdf document.


    Please any one help me. Thanks in advance.

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: How to Create PDF document in ASP.NET

    ShivKumar, you should not post multiple threads for the same question.

    If you do a simple google search, you will get 100s of samples showing you how to build PDF documents using ASP.NET. Here is a set of free libraries that you can use to generate PDF documents:
    http://csharp-source.net/open-source/pdf-libraries

    Although this is a C# site, you should still be able to convert the code to VB.NET using Developerfusion's C# to VB.NET Converter

  3. #3
    Join Date
    Oct 2005
    Posts
    175

    Question Re: How to Create PDF document in ASP.NET

    Shuja ji,

    thanks a lot for your guidance.
    some how I m now able to generate pdf files. but I have a new issue.
    when I m running the web pages, generated pdf files are stored automatically in the location

    C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\.

    when I copied the web pages to the server, i dont know on which location these pages are created.

    I want to create these pages to a location which I specity. Or it can go directly to the printer.

  4. #4
    Join Date
    Oct 2005
    Posts
    175

    Thumbs up Re: How to Create PDF document in ASP.NET

    I got it done my self.
    I just added : Server.MapPath("Temp\") + : in below line and it started working fine

    Dim Writer As PdfWriter = PdfWriter.GetInstance(Document, New FileStream(Server.MapPath("Temp\") + SlNo + ".pdf", FileMode.Create))

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured