hi i don't find a sub forum for printing so i decided to post it here.
I am using Infragistics4.Win.UltraWinPrintPreviewDialog.v12.2 and having the following 2 questions
1. I have a list of print documents to be put together on the fly and show in the print preview dialog. i used the following to set print content
printDocument.RichTextBox.Rtf = sRtf;
the problem is it can only preview one at a time. I need something like this, i have 2 print documents. doc1 has 2 pages and doc2 has 3 pages. the print preview should show a total of 5 pages with first 2 show doc1 and last 3 show doc2. How can i do it?
2. i used the following to print the current page in the footer.
printDocument.Footer.TextCenter = "[Page #]";
it works but i am wondering of it's possible to display something like "[Page # of ?]" with the question mark being the total number of pages.
Hello,
I am just checking about the progress of this issue. Let me know If you need my further assistance on this matter?
Thank you for using Infragistics Components.
Hello,
How is supposed to know how many pages the PrintDocument would fit on without print it (call Print method which will calculate total pages)? For printing this is an new product idea, and you could submit in on the following link:
http://ideas.infragistics.com
if you want to count the total pages count you could handle PrintPage event and to count how many times it will fires, you could use code like the following, and you should know that it will affects your performance.
PrintController printController = new StandardPrintController(); var controloer = doc.PrintController; doc.PrintController = printController; doc.PrintPage += doc_PrintPage; doc.Print(); doc.PrintPage -= doc_PrintPage; doc.PrintController = controloer;
void doc_PrintPage(object sender, PrintPageEventArgs e) { total++; }
About your second part of your issue:
What I assume happens here is the you have set Fother.Text[Left] = “[Page #]” of your UltraGridPrintDocument which will going to be merged combined. If so then you will get the Page number of the printed page of the current printed UltraGridPrintDocumen. Since each UltraGridPrintDocument in your MultiPrintDocument starts printing from page 1, which is expected. If you want this to works properly your MultiPrintDocument must be derived from UltraPrintDocument and you should apply Fother.Text[Left] = “[Page #]” to instance of your MultiPrintDocument instead of an individual document in it. Please see the attached sample.
I hope that this will helps you.
hi Hristo, thanks for the reply.
We used to use DevExpress and they had such syntax [Page # of Pages #] and were able to give for example Page 1 of 6, 2 of 6 etc. so I wondered Infragistics can do the same. I am not talking about generating on demand here, just one single print document that has multiple pages. there's no way to show "Page 1 of 6"?
anyways I applied the code and it seems working, i can print each doc on a new page now.
but the problem is again the page count, at least the page number should be provided sequentially. Right now page one shows "Page 1" and page two again shows "Page 1". so in Infragistics there's no way to do it?
Hello ,
In order to complete your point 1. Of your requirements you will need to merge/combine your PrintDocument objects in order to be able to show them on a single PrintPreview. On the following link you could see simple tutorial of how you could do this:
http://www.csharp-examples.net/combine-multiple-printdocuments/
About your second question, since print page are generated on demand (this means that they are not pre-created ) you can’t know how many pages there will be.
Please let me know if you have any further questions.