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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:11:33+00:00 2026-05-26T14:11:33+00:00

I am doing a web browser with multiple tabs and each tab probably will

  • 0

I am doing a web browser with multiple tabs and each tab probably will have a new website differs from the other tabs.
now what i am trying to do is to print the page on a specific tab and the page might consists of multiple pages when i am trying to print.
this is my code and the problem with the code is it is only printing one page and on the last tab had been opened. any suggestions:

  //this is the printDocemnt from the toolbox
  private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
    {
        Font font1 = new Font("Arial", 16, FontStyle.Regular);
        e.Graphics.DrawString(rtb.Text, font1, Brushes.Black, 100, 100);//rtb.Text is a richtextbox object that i initialize in the beginning of the form

    }

    //this is the printbutton just a normal button
    private void PrintButton_Click(object sender, EventArgs e)
    {
        printDialog1.ShowDialog();
        printDocument1.Print();
    }
  • 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-26T14:11:34+00:00Added an answer on May 26, 2026 at 2:11 pm

    This is how i did it: the Print document contains this code:

            private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Font font1 = new Font("Arial", 10, FontStyle.Regular);
            //e.Graphics.DrawString(tabsProperties[tabsProperties.IndexOf(new TabProperties(this.tabControl1.SelectedIndex))].TabHtml, font1, Brushes.Black, 100, 100);
    
    
    
            int charactersOnPage = 0;
            int linesPerPage = 0;
    
            // Sets the value of charactersOnPage to the number of characters 
            // of stringToPrint that will fit within the bounds of the page.
            e.Graphics.MeasureString(stringToPrint, font1,
                e.MarginBounds.Size, StringFormat.GenericTypographic,
                out charactersOnPage, out linesPerPage);
    
            // Draws the string within the bounds of the page
            e.Graphics.DrawString(stringToPrint, font1, Brushes.Black,
                e.MarginBounds, StringFormat.GenericTypographic);
    
            // Remove the portion of the string that has been printed.
            stringToPrint = stringToPrint.Substring(charactersOnPage);
    
            // Check to see if more pages are to be printed.
            e.HasMorePages = (stringToPrint.Length > 0);
    
        }
    

    this is the print button:

       private void PrintButton_Click(object sender, EventArgs e)
        {
            stringToPrint = tabsProperties[tabsProperties.IndexOf(new TabProperties(this.tabControl1.SelectedIndex))].TabHtml;
    
            printDialog1.ShowDialog();
            printDocument1.Print();
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been doing web development for a while and have yet to read a
When doing some web maintenance today, I noticed a strange new folder on my
I've been doing some Web-Projects lately that rely on heavy Data-Binding and have been
When doing web development, you frequently make changes and then refresh the browser. Is
I would like to have some Javascript code running in a web browser write
I have created an App on Heroku which works perfectly in a Web Browser.
I'm doing a Java application that requires to use a web browser inside the
I am working on a experimental website (which is accessible through web browser) that
At the moment im doing a chat web app where multiple users can chat
I am currently developing a web application which will be used by multiple clients,

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.