Recently, for one of my current clients, I had to create a RDLC Report. More specifically an invoice on a digital stationary paper. (see “stationary_paper_example.png” 1).
Problems
When a high-resolution image is set as report background the scaling of the image is completely off. See “stationary_paper_falsely_scaled.png” 2
Previous workaround
As the reports with digital stationary paper were introduced just a project before, we got it working by setting an image-element in the background (z-index) and set a high-resolution image. But this time we got some new implicit restrictions.
Implicit restrictions
- Current page number
The client wanted to show the current page number above the invoice articles table (see "stationary_paper_page_number.png" 3). You can get this information only in the header or footer section of the report
- Image-Element
The image element I set as “report background” can’t be placed inside header, body and footer of the report (see "stationary_paper_image_as_background.png" 4)
So either the client would change their report layout or I get this thing going.
New problems
- Setting high-resolution image as background
As already mentioned, when you simply set a high-resolution image as background you will (probably) experience a “scaling” bug as seen in “stationary_paper_falsely_scaled.png” 2. The image is rendered almost completely out of scope.
- Setting low-resolution image as background
If you set a low-res image as background you will (probably) see a kind of fuzzy background as seen in “stationary_paper_low_res.png” 5. This will also happen when you export this solution with a “pdf printer” such as “Microsoft print to pdf”.
After some digging and testing I finally got it working (at least imo)
Solution
I set the background of the report as following:
Result
Higher performance as a lower resolution can be set and, if you want, a “preview” watermark 1
Still fuzzy as we can’t set the resolution in “reportviewer_PrintingBegin” or “reportviewer_Print”
When exported via export of the reportviewer control you will now get a beautiful high-resolution image as background of the report
Further consequences
As the users of my client were used to “print to pdf” the client now either needs to train the users to use the reportviewer export button or a separate button “Export to PDF” will be introduced in the view.