Report RDLC Variable paper size

I have a ticket-report.
It will be printed to PDF and send to a ticketprinter over the webclient.

The RDLC has a fixed width of 8cm, but needs to have a variable height.
The ticket should contain exactly the content and no extra white space at the bottom of the PDF.

When the height in the paper size of the RDLC is set to a value, the PDF will be split in pages with a height of that value.
Example: height = 15cm
Report contents has a length of 16cm.
The result will be 2 pages: one page with full contents and another page with 1cm of contents and 14cm of white space.
This means 2 tickets will be printed.

Q: Is it possible to set the page height variable?

From testing: it can't.
Pagesize is defined at designtime, and it has no clue about the amount of data that will be used in the report at runtime (henceforth it can't know the exact page heigth).

Setting the page height to blank, makes the report default to A4 height of 29.7cm (no clue where this comes from).

Setting the page height to 0, gives the following error:
Error while validating RDL content:
The value of the PageHeight property for the report section ‘ReportSection0’ is “0”, which is not a valid size. Valid sizes may not exceed 455 inches (1155.7 centimeters).

Setting the pageheight to 1cm, creates many small tickets, but reduces the white space at the end.
This has also as effect that white space is introduced inbetween the content (in order to fit the content of each row/area on a page of 1cm).

Setting the pageheight to something very large (100cm), creates 1 long ticket, where most of the ticket is whitespace.

So any ideas how to solve this (if it's possible)?

Using NAV2017CU2.1 & Visual Studio Premium 2012



  • Options
    gerdhuebnergerdhuebner Member Posts: 155
    Since the RDLC-Layout is stored in the NAV report object in xml format, there should be an xml-tag <PageHeight> (you can see it, if you export a report object from NAV in txt format).
    So all you have to do is to modify the PageHeight tag at runtime, when the report layout is exported to print the report. This could be done in the function GetCustomRdlc in Codeunit 9650 for either built-in layouts or custom layouts. Note, that GetCustomRdlc is called from Codeunit 1.
Sign In or Register to comment.