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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:04:00+00:00 2026-06-12T04:04:00+00:00

I am looking to print using C#, Microsoft Visual Studio, asp.net. The goal: I

  • 0

I am looking to print using C#, Microsoft Visual Studio, asp.net.

The goal: I am trying to print all pages in a fax document.

Format: The fax document is received as a single .tiff file with multiple pages.

What needs to be done:- I need to iterate each page in the .tiff image and print them all.

// This function will iterate all pages, one at a time. //

 protected void PrintAll_Click(object sender, EventArgs e)
 {
    // counts number of pages in the fax document.//
    int number = _FaxPages.Count;
  
    // for loop to iterate through each page. //
    for (int i = 0; i < number; i++)
    {
        string _FaxId = Page.Request["FaxId"];

        _PageIndex = i;

        imgFax.ImageUrl = "ShowFax.ashx?n=" + _FaxId + "&f=" + _PageIndex + "&mw=750";

        PrintAll.Attributes.Add("onclick", "return printing()");             
    }
}

and In my Java script I have:

function printing() { window.print(); }

Now the issues are:

  1. The function only prints one page (the very last page of the tiff file)….and it prints the entire window and not just the embedded .tiff image in the entire web browser window.

    Any Ideas of how to go about just printing the .tiff embedded image instead of the entire web browser window.

  2. Although my for loop iterates through the pages. The print function is only called after the loop has iterated through all the pages and stopped on the final page (say page 6/6). And then it only prints that last page (along with the rest of the contents on the browser window). This is not what I want to happen… I dont want to print all the excess material on the browser window such as buttons, links etc… I just want the embedded .tiff image from the browser window.

  • 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-12T04:04:01+00:00Added an answer on June 12, 2026 at 4:04 am

    Your current code will loop through all pages on the server side and update the image URL, before sending the page to the client. This means the ImageUrl will always be your last page only.

    For printing all the images, there are multiple solutions:

    • Edit your ShowFax.ashx, add an option to render all fax pages at once and put this in the image URL.
    • Add a new Image element for each page to a parent container at runtime.
    • Have the javascript function printing() do a postback, increase the page index and the URL on the image and repeat the code.
    • Create the entire loop clientside.

    For printing only the image, hide the other elements with a CSS stylesheet and add a media="print" like this:

    <link rel="stylesheet" type="text/css" media="print" href="print.css" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following code (written with Visual Studio 2010 and .NET 4.0) using System;
Microsoft Visual C# 2010 Express I've been looking all day for a way to
I'm using Microsoft SQL Server 2005. I think I need a sub-query. I'm looking
I've been using Microsoft SQL Server Management Studio for multiple manual SQL queries for
Using VBA with a reference to Microsoft Scripting Runtime. I'm trying to compare filenames
I am working on creating a Windows Forms Application in C++ using Visual Studio
The following code (packaged in a 'Console Application' Visual Studio project): using System; using
I am wanting to implement automated testing, using the Microsoft testing framework in Visual
im looking for a way to print the array as is after each pass.
I am looking for a possibility within C/C++ to print a float (or double)

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.