Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5948959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:10:57+00:00 2026-05-22T17:10:57+00:00

So, I need a PDF generator for my ASP.NET application. I downloaded iTextSharp because

  • 0

So, I need a PDF generator for my ASP.NET application. I downloaded iTextSharp because it seems to be the most popular free one. But after searching the internet I am not really finding the information I need to get me started. The few tutorials I’ve found so far are too confusing. I know there’s a book out there but I’m a student and don’t want to spend the money. I just need really basic step-by-step information, preferably with code in VB. The most basic tutorial I’ve found so far is http://www.mikesdotnetting.com/Article/80/Create-PDFs-in-ASP.NET-getting-started-with-iTextSharp, but it’s not working for me. I tried to follow it and came up with this code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.IO; 


public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
    var doc1 = new Document();
    string path = Server.MapPath("PDFs");
    PdfWriter.GetInstance(doc1, new FileStream(path + "/Doc1.pdf", FileMode.Create));
    doc1.Open();
    doc1.Add(new Paragraph("My first PDF"));
    doc1.Close();
}
}

But it gives me an error: “CS1502: The best overloaded method match for ‘iTextSharp.text.pdf.PdfWriter.GetInstance(iTextSharp.text.Document, System.IO.Stream)’ has some invalid arguments” and the line highlighted is PdfWriter.GetInstance…

So anyway, I was wondering if anyone knows either what I did wrong on this tutorial, or what other tutorials I can use. Or if you want to give me a basic explanation of how to get started in your own words, that would be great. Keep in mind I unfortunately know absolutely nothing about this. 🙂 Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:10:58+00:00Added an answer on May 22, 2026 at 5:10 pm

    It’s hard to tell, but I’m going to guess that your doc isn’t an iTextSharp.text.Document; With all those “using” commands, it’s quite possible you’ve imported multiple classes named “Document” and are getting the wrong one.

    You should be able to use the fully qualified name to see if that’s really the problem:

    var doc1 = new iTextSharp.text.Document();
    

    (Fair Warning: I don’t know vb.net, so the actual syntax might be Quite Different)

    using spam is going to create problems with name collisions sooner or later. “Sooner” in this case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to print PDF's generated in an asp.net application using crystal reports. Upon
I need a pdf generator for Rails 3.1 application.Which one can you suggest. I've
is there a good and free PDF generator library for delphi ? I need
I am using Asp.net mvc3 and displaying the .pdf file on my one of
Hi I am developing an ASP.net web application. I need to find the current
I'm developing an Asp.Net 3.5 application and I need to print some application generated
I have an ASP.NET website and from one of the web pages I need
In an ASP.NET project I need to generate a PDF for the user to
I've a requirement to be able to generate PDF's within our (ASP.net) application. We
I need to generate a PDF and an Excel file from my ASP.net MVC

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.