1

I'm struggling with a problem in SSRS. I have created a customer invoice that is looking good in report viewer however, it needs to be set to print in a certain way.

There are 4 main elements to this report.

  1. Header, this needs to repeat on every other page if the invoice details + footer do not fit on the first page.
  2. Invoice details, this needs to repeat on every other page if the invoice details and footer do not fit on the first page.
  3. Footer, this needs to repeat on every other page if the invoice details and footer do not fit on the first page.
  4. Back of page (payment details, like a bank statement), this needs to repeat on every other page without the header, invoice details or footer.

Is this even possible? If not, the end user has accepted that the first 3 parts of the invoice to repeat as necessary and just the last page to be the payment details.

Thanks in advance

Easy987us
  • 21
  • 4

1 Answers1

0

Getting the Report Header and Footer to repeat on every page should be pretty straight forward.

Now if you have some additional information outside of the report content you wish to repeat on every page you could do the following:
As you are probably already aware, when using a Tablix it's possible to repeat table header rows on each page . This can be used to our advantage by adding Tablix with a single column and making it span the size of the page, in both the header and data rows you add rectangles so it acts like the report body. In the header row you can add any data/text you wish to repeat on the next pages.

Now as you want the back-side of the pages to have text on them, you probably don't want this to repeat on every page. Because the back of the pages is always the same static data, you could simply generate your report the way it's set up right now and insert the static page between the pages of the report.

To achive the last part you could use some code like this:

String inputFilePath1 = @""; //back of page
String inputFilePath2 = @""; //report
String outPutFilePath = @""; //final report

PDFDocument doc1 = new PDFDocument(inputFilePath1);
PDFDocument doc2 = new PDFDocument(inputFilePath2);

// Get a page from the first document. -> back of page
PDFPage page = (PDFPage)doc1.GetPage(0);

for(int i = 1; i <= doc2.PageCount; i++)
{
   if (i % 2 == 1)
   {
      // Insert the page to the second document at specified position.
      doc2.InsertPage(page, i);
   }
}

// Output the new document.
doc2.Save(outPutFilePath)
Oceans
  • 3,445
  • 2
  • 17
  • 38