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 8891543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:46:25+00:00 2026-06-14T22:46:25+00:00

On button click I need to read the HTML file and convert it to

  • 0

On button click I need to read the HTML file and convert it to PDF. The PDF is generating without any problem. But the width of columns in table is equally distributed when converted to PDF. But I need the first column of my table to take 70% of the total size of my table (540)

How can I do this?

Template.html :

 <table runat="server" id="header" border="3" width="540">
        <tr>
            <td style="width:70%; text-align: center; font-weight: bold;">
                <strong>Test Specification </strong>
            </td>
            <td style="width:10%; text-align: center; font-weight: bold;">
                <strong>GST </strong>
            </td>
            <td style="width:10%; text-align: center; font-weight: bold;">
                <strong>Service </strong>
            </td>
            <td style="width:10%; text-align: center; font-weight: bold;">
                <strong>Amount </strong>
            </td>
        </tr>
    </table>

Button click to convert HTML to PDF :

    protected void Button1_Click(object sender, EventArgs e)
        {
            String htmlText = System.IO.File.ReadAllText(Request.PhysicalApplicationPath + "\\Template.htm");
      Document document = new Document();
            PdfWriter.GetInstance(document, new FileStream(Request.PhysicalApplicationPath + DateTime.Now.ToString("ddMMyyyy") + "_" + DateTime.Now.ToString("HHmmss tt") + ".pdf", FileMode.Create));
            document.Open();
      iTextSharp.text.html.simpleparser.HTMLWorker hw = new iTextSharp.text.html.simpleparser.HTMLWorker(document);
            hw.Parse(new StringReader(HTML));
            document.Close();
            StringBuilder sb = new StringBuilder();
            sb.Append(HTML);
    }
  • 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-06-14T22:46:27+00:00Added an answer on June 14, 2026 at 10:46 pm

    You need to use a combination of colspan and LoadTagStyle, both of which are outside the bounds of what I can fit in this textbox. To simplify, iTextSharp treats the total number of columns as 100% of the table, so a colspan of 5 on a table that is 10 columns should be treated like 50% of the table.

    I have found that I have to play around with the values a bit, but hopefully that will lead you down the right path.

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

Sidebar

Related Questions

in my Winform a read file method is implemented on button click.when big files
In a web page button click event we need to export 2,00,000 to 5,00,000
Here i am calling a javascript function on a button click and i need
Here i need to check a button click using javascript i.e)if button A is
I need a field to store some information after one asp button click for
I need a click on the .next button in jQuery serialScroll/scrollTo to not only
i placed one button in a page .when click on that need to show
I have a hidden button on a form that I need to click in
I have a button,Linkbutton and an ModalPopup. If I click button1 I need to
When i click on OK button of an UIAlertView, i need to change the

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.