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

  • Home
  • SEARCH
  • 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 6215917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:08:32+00:00 2026-05-24T07:08:32+00:00

I have a user control which has a panel used to display the information

  • 0

I have a user control which has a panel used to display the information which I print when needed.
I have a grid view in which I get search result It has a link button clicking on which I want to open a pdf of that panel in the above one.

  • 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-24T07:08:34+00:00Added an answer on May 24, 2026 at 7:08 am

    I have implemented this, and I hope someone else can do it as well. I have listed my code below.

        using iTextSharp.text;
        using iTextSharp.text.pdf;
        using iTextSharp.text.html;
        using iTextSharp.text.html.simpleparser;
    

    Import the above DLL

    string attachment = "attachment; filename=" + "File Name" + ".pdf";
        Response.ClearContent();
        Response.AddHeader("content-disposition", attachment);
        Response.ContentType = "application/pdf";
        StringWriter stw = new StringWriter();
        HtmlTextWriter htextw = new HtmlTextWriter(stw);
        htextw.AddStyleAttribute("font-size", "7pt");
        htextw.AddStyleAttribute("color", "Black");
        Page pg = new Page();
        HtmlForm frm = new HtmlForm();
        pg.EnableEventValidation = false;
    
        pg.RenderControl(htextw);
        Document document = new Document();
        document = new Document(PageSize.A4, 5, 5, 15, 5);
        FontFactory.GetFont("Arial", 50, iTextSharp.text.BaseColor.BLUE);
        PdfWriter.GetInstance(document, Response.OutputStream);
        document.Open();
        //This is how you can add text in div in a pdf
        Chunk c = new Chunk(TextHere + "\n", FontFactory.GetFont("Verdana", 15));
        Paragraph p = new Paragraph();
        p.Alignment = Element.ALIGN_LEFT;
        p.Add(c); p.Add(c1);
        // This is how you can generate table and can set proprties
        PdfPTable table = new PdfPTable(2);
        table.WidthPercentage = 100;
        //Bill No and Bill Date
        PdfPCell pdfcell1 = new PdfPCell(new Phrase("Text in TAble" + "TExt From Database"));
        pdfcell1.Border = iTextSharp.text.Rectangle.BOTTOM_BORDER | iTextSharp.text.Rectangle.TOP_BORDER;
        table.AddCell(pdfcell1);
        PdfPCell pdfcell = new PdfPCell(new Phrase("Text in TAble" + "TExt From Database"));
        pdfcell.Border = iTextSharp.text.Rectangle.BOTTOM_BORDER | iTextSharp.text.Rectangle.TOP_BORDER;
        pdfcell.HorizontalAlignment = Element.ALIGN_RIGHT;
        table.AddCell(pdfcell);
    
        document.Add(p);
        document.Add(table);
        document.Add(tablegrid);
        StringReader str = new StringReader(stw.ToString());
        HTMLWorker htmlworker = new HTMLWorker(document);
        htmlworker.Parse(str);
    
        document.Close();
        Response.Write(document);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a user control which has a textbox on it, now this usercontrol
I have user control named DateTimeUC which has two textboxes on its markup: <asp:TextBox
I have a user control - say ControlBase. It has SomeItems property, which is
I have a user control which has several radiobuttons and buttons... I have code
I have 3rd party user control (a captcha control), which has a captcha image,
I have a page which is used to display numerous forms for the user
I have a user control (the one which is .ascx), it has lots of
I have a user control which takes a Func which it then gives to
I have a user control which does some validation in the ValidateChildren method which
I have a user control which displays the currently logged in user's name. I

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.