Generating html content that gets extra page in the print preview mode

1 Answer 150 Views
Rendering Styling
Alex
Top achievements
Rank 1
Alex asked on 23 Aug 2023, 02:13 PM

Hello!

It's used the next version of telerik: Telerik_Reporting_R2_2020_SP1_14_1_20_618

After trying to open the generated html content in the preview mode in different browser the additional pages appeares. In the template all looks good but some unexpected things appeared on the generated html (screenshot was attached):

1. unexpected border (border: 2px solid darkblue;) appeared around the all report content

2. Ctrl+P gets 2 pages but it's expected 1!

3. unexpected css styles appeared in the <head> and a lot of inlined styles appeared at all tags. For instance, the next style at <body> tag  

style="padding-left:57px;padding-right:38px;padding-top:57px;padding-bottom:38px;width:102

gets the mentioned extra page. How it's possible to control the process of generating this styles??

Generated pdf content gets an expected 1 page during the printing.

I attached the template and html rendering result in the archive

Thanks

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 28 Aug 2023, 11:05 AM

Hi Alex,

Thank you for the attached resources. Unfortunately, the report is not runnable due to the missing ObjectDataSource source and subreport.

I opened the HTML file in the Chrome browser under Windows and it displayed a single page. With 'Ctrl+P' the page was also 1, although with a cut right border - see the linked image for reference. I guess the border was not displayed as the paper width was shorter. Note that this type of printing from the browser does not involve Telerik Reporting. It simply paginates the browser content with its own mechanism. If you need to print a Reporting document, you may use the HTML5-based viewers Print functionality.

Regarding the unexpected border of the HTML document, it is set by design in the following CSS style:

print-page > .sheet
{
	border: 2px solid darkblue;
	/* centers the DIV horizontally */
	margin-left: auto;
	margin-right: auto;
	margin-top: 10px;
	margin-bottom: 10px;
	-moz-box-shadow: 5px 5px 5px #888;
	-webkit-box-shadow: 5px 5px 5px #888;
	box-shadow: 5px 5px 5px #888;
}

All the CSS styles in the <head> element define the layout of the page and its elements. The inline styles may include the position and other specifics that are calculated during the rendering process. Note that the positions and sizes depend on the DPI you generate the report documents with. So, if you generate the HTML in a server machine and open it on a client machine with different DPI settings, there may be issues with the size and the paging.

You may control the styles from the report items' and sections' properties in the report definition. They would be converted to CSS styles. The other controllable options in HTML rendering are listed in the Device Information Settings for the HTML5 rendering format.

For more details, you may check the article Design Considerations for the HTML Rendering.

Regards,
Todor
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
Tags
Rendering Styling
Asked by
Alex
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or