Programatically force printer to print duplicates - c#

I am using Active Reports in C#, and one option we present the users with is to print to a tray where the paper is White/Pink alternating.
Is there a printing method by which I can programatically cause each page to print twice, yet still collate correctly?
Edit:
My intended result is the following pattern:
Page one (white)
Page one (pink)
Page two (white)
Page two (pink)
Page one (white)
Page one (pink)
Page two (white)
Page two (pink)
Thus, each page is duplicated every time it prints.
Currently, I must disable collating and then print double the number of copies the user is asking for. However, the user must then manually assemble the documents.
Thanks for any help!

I see. So your report is by definition has to be duplicated on White and Pink and this duplication needs to be repeated based on users number of copies.
If you are using Page Reports you can design two page templates one for each "page color", use a master page to share the design elements of the page. You can also control that the pink pages is not visible in the viewer and are print only.
If you are using Section Reports, you would have to manage the duplication manually in your code. The Document class has a pages collection that you can manipulate, copying the page and inserting it into another location. Before printing you would need to copy p1 and p2 and insert them at the end, your report would now have four pages p1W, p1P, p2W, p2P. if the user prints multiple copies with collation on, everything should come out OK.
http://arhelp.grapecity.com/webhelp/AR10/index.html#GrapeCity.ActiveReports.Document.v10~GrapeCity.ActiveReports.Document.Section.PagesCollection~Add.html
hope this helps.
http://activereports.grapecity.com

Related

Active Reports - Find out what page a control is on before the final print

I need to find out what page a control is on after all the report data has been added. Depending on how much data has been added above (e.g. table rows), the control could be on page 1, 2 or even 3. The reason for needing the page number is to find out if that control straddles two pages. If it does then I want to nudge it down enough to make sure its not split over two pages
As the control in question is dynamically added during the ReportStart event I can't tell what page it will ultimately end up on as the report data hasn't been added yet.
I'm pretty sure i'll be able to do this in the Detail_BeforePrint event as it fires for each page of the report and this.PageNumber gives the current page.
Inside Detail_BeforePrint I can find the control using:
var myControl= this.Detail.Controls["MyControl"];
But myControl does not have any properties that might suggest what page its on. Can anyone help?
I'm using Active Reports 6 and Visual Studio 2010
What you're asking for is not possible to find out. You can retrieve the pageNumber from the report but that would tell you the last page the control will print to. The control does not have a page number because it is possible for it to print on more than one page.
However with that said, it is possible to get the effect you want using KeepTogether property. if you set it to true, AR will always try to keep the control on a single page and move it automatically for you. And it handles the case where the length of the control might more than a single page so it wouldn't need to be moved since that would have no effect. Hope this helps.

setting number of records per page using Active Reports 9

I am working on Page Reports type of Active Reports 9 and I want to set the number of records/ rows displayed per page. By default it is showing 2 records per page, spanning up to 11 pages. I would want to display 10 records per page. Can this be done using any of the existing properties of the reports or do I have to add a script to execute the same? Since I'm new to active Reports would be great if I get an aid on the scripting if necessary.Thanks.
ActiveReports FPL(Fixed Page Layout) reports are designed for exactly this type of situation. They allow the report developer to build reports that look exactly the same at runtime as they do at design time.
FixedSize is a property available on the data region(table, matrix, list, etc.) controls of a page report. By setting the fixed size property to a certain height, you can add or reduce the number of records that will be displayed on a single page. More information on setting the FixedSize of a data region can be found here: http://helpcentral.componentone.com/netHelp/AR9/SetFixedSizeOfADataRegion.html
If you're still having trouble, a sample demonstrating the displaying of 10 records on a page can be found here:
http://publicfiles.componentone.com/Patrick/10RecordsPerPage.zip

How to do a page break in crystal reports when next group won't fit on current page?

Hello I have the following report that is generated on CR.
I have the same file in a couple of sites, but each returns a different pdf despite sending the same data:
Example 1:
Example 2 :
As you can see, in the second example, once one of the tickets finishes, another one starts after it on the very bottom, which makes it incomplete.
In the first example, it automatically sends it to the next page once it finds that the next one won't fit in the current page.
I can't seem to remember what I did to fix that, nor I understand why do I get different results in two different sites using the same rpt file with the same provided data.
Check new page after option im the section expert of the group so that new group starts on a new page
You say "I get different results in two different sites", means 2 different browser?
The output of same file will always comes same, first thing. Second is you just give your page margin of header- footer much more from the ticket size, so give always same result.
It may be some height issue at execution time, it give different result. So safer side , give as much as height and low-margin of page by report option -> page size.

Printing a separate report webpage without displaying in ASP.NET

This is somewhat related to my previous printing question re: remote printing, which I resolved with help here at work. This new situation likely has a simple answer as well, but I have yet to discover it.
To simplify, I have two webpages written in ASP.NET with C# codebehind, which we can call page1.aspx and page2.aspx.
The first page, page1.aspx, is a simple search tool that opens a database and returns a list of reports matching the search criteria into a gridview. The second page, page2.aspx, displays a report in the web browser, given the report ID as a query variable (which I have working). This page is also pre-formatted to be printer friendly.
On page1.aspx, in my gridview, I have two buttons for each row labeled "View" and "Print". The "View" button will retrieve the appropriate order number for the corresponding row, and page2.aspx will load the report based on the order number (again passed as a query variable).
For the "Print" button, however, I would like to print. That is, when the user clicks the button, instead of the page loading onto the screen, I would like for the Print dialog to pop up and allow the user to print the report directly to the printer (since they are able to view the report using the separate button if they should so desire).
I would load page2 into an iframe, probably separately and have the page call a JavaScript print when loaded, or call focus on the iframe and then print on the same object.
You could load the page with a new call, or just load it when page1 loads in the background.
You would, of course, make the iframe hidden from view.

WinForms.ReportViewer - number of pages that are rendered

Using WinForms.ReportViewer I'd like to get a hold of the number of pages that are rendered.
I need to generate a contents page for a collection of reports and to do this I need to know how many A4 pages are rendered for each report so that I can subsequently generate the contents page. The reports are able to be edited by the end user and replaced so that the next time it's run the number of pages could be different and so the contents would need to be re-generated.
I've managed to get the reports to load at runtime based on the files provided by the end user, but getting hold of the number of pages the report renders is proving quite difficult. I know I can get this information in the header of the report, but know of no way to get that information back out, programatically.
Try using:
int pageCount = Viewer1.Document.Pages.count;
I actually just needed to do an Application.DoEvents() call after calling the display method, before checking the page count. It obviously renders the report in a separate thread...

Categories

Resources