Page Count during report creation

80 views
Skip to first unread message

Matt Bergen

unread,
Dec 9, 2013, 2:47:35 PM12/9/13
to dot-net-...@googlegroups.com
Is there any way to get the page count while the report is being created?  I am currently trying to convert one of my reports from an old version of ReportWriter (v8) with the newest version (v10) and have a situation where I need to be able to add blank pages to certain sections depending on whether there is an odd number of pages.  This report gets printed with duplex printing and so if for example Section 1 only has one page, then I need to add a blank page to that section so when we print the report with duplex printing the first page in Section 2 won't print on the back of the first page and if the page in Section 1 flows to a second page then I don't want to create a blank page.

In v8 the Report class had a Reset() method that allowed us to call Generate() to get the current page count and then call Reset() to reset the report so then next time we call Generate() we get updated information.  v10 doesn't appear to have this, so I'm not sure how to go about this with the latest version, any ideas?

Thanks,
Matt

siberix

unread,
Dec 9, 2013, 3:40:21 PM12/9/13
to dot-net-...@googlegroups.com
Hi Matt,

Please see below:

1. You may use the conditional PageBreaks (add the to the end of your sections or where you expect to have blank pages) that will be inserted only if (even or odd) condition applies. For example.

IPageBreak pb = section.AddPageBreak();

pb.Range = Siberix.Report.MasterRange.Even. // Page break that is inserted only if page is even.

2. The other way is to call the Generate method on the report to get the IPageCollection and then iterate through this collection and render it via Canvas elements into a second Report. Please take a look at the CS/Booklet example available for the download as a part of the evaluation package for the Report Writer for .NET.

Siberix.Report.IPageCollection pages = report1.Generate(); // This is the original report

Siberix.Report.Report report2 = new Siberix.Report.Report(); // This is a new report where you can add some extra pages, do advanced overlay drawings, etc.

section = report2.AddSection();
section.Size = Siberix.Report.PageSize.Letter;
 
foreach (Siberix.Report.IPage page in pages)
{
Siberix.Report.ICanvas canvas = section.AddCanvas();

Siberix.Graphics.IGraphics graphics = canvas.AsGraphics();

canvas.Width = new Siberix.Report.RelativeWidth(100);
canvas.Height = new Siberix.Report.RelativeHeight(100);

page.Draw(graphics);
}

report2.Publish("FinalReport.pdf", Siberix.Report.FileFormat.PDF);


Please let me know if this helped you to resolve the issue and please don't hesitate to contact me should you have any further questions.

Thank You,
Victor

Matt Bergen

unread,
Dec 9, 2013, 8:12:01 PM12/9/13
to dot-net-...@googlegroups.com
Victor,

Thank you the PageBreak.Range was exactly what I was looking for.  Another question, how would I go about properly adding a transparent image to my report.  I'm currently implementing by adding the transparent color (Black) to the DrawImage method.  However, when I generate a pdf, the pdf image being rendered very choppy (see attached).  When I print directly to printer the image prints perfect, it is only when rendered in a PDF.  Any thoughts?
PDF_Image.PNG

siberix

unread,
Dec 9, 2013, 8:37:32 PM12/9/13
to dot-net-...@googlegroups.com
Hi Matt,

You need to use a PNG image with a color or alpha transparency. Other image formats with transparency are not supported in the Siberix Report Writer v.10.

Thank You,
Victor
Reply all
Reply to author
Forward
0 new messages