Report file Print (Multiple objects) c# - c#

I've been working on a project in C# which uses a RDLC report with an Excel file as its source.
My problem is that I have made a single rectangle on the report, and I want it to be printed multiple times on the page (i.e. On an A4 size paper, when I print it, I want 10 prints of the rectangle on the page [5 on left and 5 on right side of the page]).
I am getting 5 prints of the rectangle on the left side only. What should I do to get 10 prints (as described above)?
How can I use the Page Break functionality in the RDLC to accomplish this?

Related

How to show report data in center of RDLC report?

I am using RDLC to generate product receipt but facing issue with layout and design in RDLC.All my report contents are not coming in the center.
My page size is 7.30 centimeter and I want this content to be in center of the report
This is what I am trying to achieve(Expected Output) :
https://i.stack.imgur.com/eV8Mc.png
This is what I am getting :
Also my first table side border is cut as shown with red circle.
How do I make all my contents in center of the rdlc report ?
Updated : Print Layout setting of reportviewer with A4 size and Landscape:
This is what it looks like when I print receipt using Thermal Printer :
There are 2 receipt in above image : Original company generated receipt(right side) and the one generated by rdlc(Left one).
Left side : That receipt is generated by my winform application using RDLC report.As you can see there are lots of content that is cut(removed) in the receipt.
Right side : This is the original receipt and output I am trying to achieve and the red circle indicates things that are being cut(removed) in my reciept(Left one).As you can see BillNo,Date,Time,Title as well as both the table contents are cut(removed in my left side receipt).
I have measured the size of table in Original receipt and it is as below :
I have tried to set the size of table i.e 5.2 centimeter in my rdlc report but there is no such option available.
Update 2 : Based on my current RDLC setting this is what I have got :
I have manage to got the receipt size as per company original receipt but now only problem here is data is not coming in center and tables are being removed(cut).
Here is the Thermal Printer setting used for original receipt :
Based on above image,that is why I have kept report Width : 8cm and Height as 29.7 cm
Looking at your photo it seems that you have a 8cm receipt with 1.4cm left/right margin and 5.2 body.
So you can use this settings in Report > Report properties > Page setup:
paper size: custom
width: 8cm
left/right margin: 1,4cm
The body width must be 5.2cm and you could fill it without using margins.
This is the output with light blue body and white margins.

Printing long receipt pdf to fit on receipt paper

I want to print a very long PDF with a receipt printer (Epson TM-T88IV).
The PDF I want to print however is predefined (I cannot change how the file is produced).
When I want to print this PDF with the Receipt printer, it prints it very very small and the receipt is unreadable.
There is a large margin left and right. To me, it looks like the Receipt printer wants to print the PDF onto a very small area.
if (type == PRINTER_TYPE.RECEIPT)
{
settings.DefaultPageSettings.Landscape = false;
settings.DefaultPageSettings.PaperSize = (new PaperSize("Roll Paper",(int)(80*0.254), (int)(297 * 0.254))); //PaperSize is taken from the Printer Settings multiplied with a hundreth of an inch
}
I couldn't find anything related.
€dit:
After some testing and printing multiple documents. I found out that the PDF Documents that print correctly have a correct Size
This one prints correctly, everything can be read when printed:
This one cannot, as it is only one large page (What I want to print ):
Is it possible to ignore the height and let the printer print the whole page correctly?
PDF pages have a fixed size, both width and height. The receipt printer is most likely shrinking the page down while preserving the aspect ratio to fit it onto the paper.
Without a way to change the PDF itself, including the layout, I'm afraid you won't be able to fit it in a legible way on to the printer.

How to print Client Report Definition file (.rdlc) on A4 size in C#?

I am trying to print a report using C# Report Viewer Control.
By the way, I bumped into a problem.
I wanted my .rdlc file to be printed on A4 size. so I changed .rdlc file size with A4 size 210X297(mm) in the VS2010 designer. But the report viewer object that uses this .rdlc file automatically sets the margins on the paper. So the total size of the paper that will be printed was over A4 size.
I can't estimate the size of the margin.
Is there any way to estimate or control the size of the margin?
I have been searching for the last some days...
I need help. please give me a hand.
My platform is VS2010 / .Net 4.0 / C#
Thanks tezzo for your help. I appriciate it.
My problem was which I didn't know the fact that Report > Report properties > Page setup exists.
I could resolve my problem by your advice.
But I had what makes me confused. so I leave some aditional pictures.
I hope it is helpful to another person who encounters such a problem.
You have to click the point that the picture 1 expresses by the check sign. If you click the point that the picture 2 expresses by the check sign, you can not see such a properties window that have a Margins and a PageSize Property, which makes me confused.
When you reach here, you can follow tezzo's advice. then you can print rdlc file on A4 size.
I am first to write here. so I can't add any picture on it.
I link pictures.
< picture 1>
< picture 2 >
You can set paper size and margins in Report > Report properties > Page setup.
I usually use this settings:
paper size: A4
size: 21 x 29,7 (landscape: 29,7 x 21)
left/right margin: 1,3cm
bottom/top margins: 1,5cm
So the maximum width of report will be:
21 - (1,3*2) = 18,4cm
29,7 - (1,3*2) = 27,1cm (landscape)

ReportViewer 2010 control either prints part of a table on a separate page or prints an extra empty page

I just started using ReportViewer control VS2010 (web, local).
My report is very simple - 4 columns, all fit on a screen fine.
When I click "print" button, the report is printed on 2 pages ( 2 columns on one and 2 on another).
If I change the margins on a page, all 4 pages are printed on the same page but I still have 2nd empty page printed as well.
If report spans across multiple pages (2 for example), with margins changed I get first page, second page is empty, then third page fine and the fourth page is empty.
Any suggestion how to make the report printed without empty pages?
Thank you,
Jenny
In my experience (which has been a painful one...), I found that if the report is printing an extra page it means that somewhere, your margins or page size of the subreports (if you're using any) are not equaling 8.5 X 11 (or whatever size paper you're using). make sure that your your table (i'm assuming that's what you're using?) is in the bounds of a sheet of paper. keep in mind you need take an inch of of each side (if you're using .5" margins [.5" for each side]) to keep the table on one page.
I had the same problem and m.webster's answer was spot on for me.
Check that the SIZE property of the reports BODY is within your REPORTs Pagesize and Margin properties.
In my case, I had set my report to A4 and the properties of the report (click in the grey area of the designed) showed: PageSize: 21cm, 29.7cm. I built my report but printing resulted in content spilling over to a second page.
When I turned on the RULER option, it was immediately obvious that my reports BODY (white content area) was wider that then PageSize of the Reports page size.
When I reduced the BODY's size->width property down to 21cm (after rearranging all my content to allow this resizing) I found there I was still getting the second page problem. A quick change to the reports margins down to 0 resolved this.
The final white space problem I had was an empty page appearing at the end of some of my reports. This was resolved by reducing the height of the reports BODY so that there was no blank space after my content. Because the initial report body appears in a nice portrait layout, I had assumed that it was just representing the final page which was not the case.
Its a bit of a late answer to the problem but I've added it to save someone else the wasted hour of head scratching when using this slightly unintuitive piece of kit.

Printing to a Dot Matrix Printer

I am printing a rdlc report to Dot matrix printer using this code . The report is in the format of a bill receipt. What i want is that the printer should stop exactly at the point where the receipt is fully printed (i.e. the end of the text to be printed) and not take in the rest of the paper and print nothing on it.
As loads of receipts are to be printed and there can be long queues, it will be time consuming if the end user has to reload the paper (which has been wasted) back to the printer. Hence i am looking for way by which the printer can stop the paper intake as soon as the text to be printed is complete.
It sounds like what you're asking for is how to print receipts as a continuous stream, instead of page by page. The code you linked to is entirely page driven and page oriented. You can work within a page-dominated view system, but you're going to have to do extra work.
You should be able to print multiple things on one page by changing the PrintPage code to output more than one image chunk per page. You will have to manage the offset of each rectangle to place the 2nd image below the 1st, and you will have to figure out what you want to do with the next report page does not fit on the space remaining on the current page. I expect the output will be clipped to the current page, so if you draw outside the page boundaries (past the end of the page) nothing will be output.
You could choose to advance to the next page when the next report image does not fit in the space remaining on the current page.
Or, you could print as much as will fit on this page, and then print the rest of that report image on the top of the next page. To do this, you will need to calculate the intersection of the remaining space on page 1 and the report image rectangle, and save the height of that intersection. End the page. When page 2 rolls around, print that same report image again, but this time offset the output rect by the height of the rectangle that was printed on the previous page. This is assuming a clipping rectangle is already in place on the print device handle (which is very likely).
The downside of splitting a report across pages like this is that you may end up with graphs or even lines of text that are cut off or split between pages. These will be hard to read. If you know the font height and line spacing and how the report is laid out I suppose you could make a calculated guess about where the lines of text fall in the output rectangle and round your output rectangle down to the nearest whole multiple of the line height, but this is getting deep into hacky kludge territory.

Categories

Resources