print charts

I want to export one of my razor. page to pdf. The screenshot is shown in the attachment.  Before the pdf is generated a new window with the desired content is populated by the following code:


var a = window.open('', '', 'height=700,width=480');

a.document.write('<html>');

a.document.write('<head>');

a.document.write('<link rel='nofollow' href="css/app.css" rel="stylesheet"/>');

a.document.write('<link rel='nofollow' href="Mladim.Client.styles.css" rel="stylesheet"/>');

a.document.write('<link rel='nofollow' href="_content/Syncfusion.Blazor/styles/bootstrap5.css" rel="stylesheet"/>');

a.document.write('<link rel='nofollow' href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet"/>');

a.document.write('<\/head>');

a.document.write('<body>');

a.document.write('<div style="width:600px;">');

a.document.write(document.getElementById(divName).innerHTML);

a.document.write('<\/div>');

a.document.write('<\/body>');

a.document.write('<\/html>');

I



It is worth mentioning that I purposely added div with a width of 600px which wraps the entire content. This allows the width of content to fit inside the A4 format. The problem is that the charts are not adjust to 600px but they are the same width as the screen size, Please see image in attachment. Is it possible to solve my issue somehow?


Attachment: img_dea7a097.zip

1 Reply

DG Durga Gopalakrishnan Syncfusion Team February 2, 2024 01:49 PM UTC

Hi Samo,


Greetings from Syncfusion.


We have analyzed your reported scenario. As per your requirement, the chart cannot be resized after it is rendered. In your attached screenshot, it appears that you initially rendered the chart with full screen width and then specified its size as 600px for printing. However, this cannot be re-rendered to the newly specified width.


By default, the chart will be resized based on the parent element size only when the window is resized. This is the actual behavior. We suggest you to specify the height and width for the chart at the initial rendering and use the same size in the print window as well to achieve your desired scenario.


Kindly revert us if you have any other concerns.


Regards,

Durga Gopalakrishnan.


Loader.
Up arrow icon