473,385 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Print multiple files continuously...

Hi All,

In my application(Web application) I need to Print more than one page one by one without giving next to Print.... That is In my application, Lots of files shows with their Name in Gridview with multiple selection option with check box. If i click only one check box then, it works fine to print. But I need to Print more than one file. That is I selected many files by checking that check boxes. then second file is automatically prints when printed the first file without giving any event thru button.... Is it possible.. Please guide me on this.....


Thanks,
Sarav
Jan 19 '09 #1
5 8696
Frinavale
9,735 Expert Mod 8TB
How are you printing files?
Are you using JavaScript to print to a client's computer, or are you printing on the Server?
Jan 19 '09 #2
I tried it from javascript.

Window.Print();
Jan 20 '09 #3
Frinavale
9,735 Expert Mod 8TB
You're either going to have to call the Window.Print() method for each selected file or you can append the selected files onto the first file and just print one file.

You should look into how CSS can help you format your printed content.
Jan 20 '09 #4
Hi.,

Herewith I have given the Code which I was used...

Expand|Select|Wrap|Line Numbers
  1.  divPrint.Visible = false;
  2.         int i;
  3.         for (i = 0; i < count; i++)
  4.         {
  5.             string cid = strSplitArr[count-1].ToString();
  6.             Correspondence_ID = Convert.ToInt32(cid);
  7.             dsCorrespondence = objBOCorrespondence.LetterDetails(Correspondence_ID);
  8.             if (dsCorrespondence.Tables[0].Rows.Count > 0)
  9.             {
  10.                 lblName.Text = dsCorrespondence.Tables[0].Rows[0]["UserName"].ToString();
  11.                 lblAddress1.Text = dsCorrespondence.Tables[0].Rows[0]["PersentAddress1"].ToString();
  12.                 lblAddress2.Text = dsCorrespondence.Tables[0].Rows[0]["PersentAddress2"].ToString();
  13.                 lblVillage.Text = dsCorrespondence.Tables[0].Rows[0]["PresentVillage"].ToString();
  14.                 lblIsland.Text = dsCorrespondence.Tables[0].Rows[0]["IslandName"].ToString()+','+dsCorrespondence.Tables[0].Rows[0]["PersentZipcode"].ToString();
  15.                 //lblZipcode.Text = dsCorrespondence.Tables[0].Rows[0]["PersentZipcode"].ToString();
  16.                 lblSubject.Text = dsCorrespondence.Tables[0].Rows[0]["TemplateName"].ToString();
  17.                 lblFirstName.Text = dsCorrespondence.Tables[0].Rows[0]["FirstName"].ToString() + ",";
  18.                 lblLetterTitle.Text = dsCorrespondence.Tables[0].Rows[0]["LetterTitle"].ToString();
  19.                 lblLetterDescription.Text = dsCorrespondence.Tables[0].Rows[0]["LetterDescription"].ToString();
  20.                 lblDate.Text = (DateTime.Today.Date.ToShortDateString());
  21.                 divLetter.Visible = true;
  22.                 //StringBuilder sb = new StringBuilder();
  23.                 //sb.Append("<script type=\"text/javascript\">");
  24.                 //sb.Append("window.open('ViewLetter.aspx?val=" + "','','height=850,width=750')");
  25.                 //sb.Append("</script>");
  26.                 count = count - 1;
  27.                 Session["val"] = count;
  28.                 StringBuilder objStr1 = new StringBuilder();
  29.                 objStr1.Append("<script language='javascript'>");
  30.                 objStr1.Append("printseleteditems();");
  31.                 objStr1.Append("</script>");
  32.                 LtPrint.Text = objStr1.ToString().Trim();
  33.                 divPrint.Visible = true;
  34.                 return;
  35.                 //LtPrint.Text = sb.ToString();
  36.             }
  37.             else
  38.             {
  39.                 PSResource.PSResourceName = "PS-Error249";
  40.                 //lblError.Visible = true;
  41.                 lblMessage.Text = PSResource.PSResourceName;
  42.                 lblMessage.Visible = true;
  43.             }
  44.  
  45.         }
  46.  
This is in Code behind Page....
Expand|Select|Wrap|Line Numbers
  1.    <script type="text/javascript" language="javascript">
  2. function  printseleteditems()
  3. {
  4. window.print();
  5. }
  6.     </script>
  7.  
  8.  
This is in Design Page....
Jan 21 '09 #5
Frinavale
9,735 Expert Mod 8TB
I'm not sure what you're doing in the above posted code.
I thought that you wanted to print selected files?
I'm assuming these files are text based...
If I were you I would loop through the names (and paths) of the selected files, read from the files and append their content to your string builder. Every time I would append a new file I would wrap it in a <div> with CSS class is set to something that would indicate a new page.

Pseudo code:

For each selectedFile
append "<div class="newDocument">" to the string builder
then append the file content
then append the closing "</div>"
Loop

After creating the content to be printed, add the JavaScript that prints to a button that allows them to print.

To make sure that each document was printed on a new page I would set the CSS class to:
.newDocument
{
page-break-after: always;
}

Check out the other Printing Styles available.

-Frinny
Jan 21 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: SpamProof | last post by:
I'd like to be able to print multiple documents are once using vb.net. What is the best way to do this with out having to print each document one at a time via a loop . Can't I send them all to...
4
by: Kim Chee | last post by:
I'm needing to get X number of files (.txt,.doc,.xls,.tiff,.pdf) into a single Print Job. The idea here is that a user searches for criteria in a system and then builds a batch of documents that...
5
by: Tom Louchbaum | last post by:
When I preview my Access 2000 Report it looks fine. When I Email the report using DoCmd.SendObject acSendReport, "Report", acFormatRTF, "To Address", , , "Subject", , False the resulting...
3
by: MHenry | last post by:
Hi, I have 30 separate Access reports to print to pdf files. Presently, I print these reports to Acrobat pdf files one report at a time. I am looking for some help, or a program or add-in...
3
by: Andrea | last post by:
Hello, I am looking for the directions on how to set a report to print continuously, without a paper feed. I have set one up using the Label Wizard, but how do I set it up in an existing report? ...
1
by: Kadir | last post by:
Hi All, I have a problem in printing reports. I have a dot matrix printer. I want to print a report that varies in height each time according to the details. If I set the page to A4 it goes onto...
10
by: Razzie | last post by:
Hi all, The title of this post may sound a bit weird, but I was wondering about the following nonetheless. I have a class libray containing, say, 4 classes: A, B, C, D. Class A somehow has a...
0
by: sherlockweb | last post by:
Hi there, I am trying to simultaneously run multiple Windows Forms (in this case 3 windows) each with a WebBrowser object. Each of the WebBrowser objects is running a PowerPoint presentation...
1
by: milti | last post by:
Hi All!! Is there any way, I can avoid the Print Dialog from appearing multiple times? Let me be more clear. I've say three files. file1.html, file2.html and file3.html. there's a button...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.