<div style="width:@pageWidth;height:@pageHeight;overflow:hidden;display:inline-block">
    <ExportComponent WebReport="WebReport"/>
</div>

@code {
    [Parameter]
    public WebReport WebReport { get; set; }

    int pageWidth;
    int pageHeight;


    protected override void OnParametersSet()
    {
        base.OnParametersSet();

        pageWidth = (int)Math.Ceiling(GetReportPageWidthInPixels() * WebReport.Zoom);
        pageHeight = (int)Math.Ceiling(GetReportPageHeightInPixels() * WebReport.Zoom);
    }

    float GetReportPageWidthInPixels()
    {
        float _pageWidth = 0;

        if (WebReport.SinglePage)
        {
            foreach (ReportPage page in WebReport.Report.Pages)
            {
                // find maxWidth
                if (page.WidthInPixels > _pageWidth)
                    _pageWidth = page.WidthInPixels;
            }
        }
        else
        {
            _pageWidth = WebReport.Report.PreparedPages.GetPageSize(WebReport.CurrentPageIndex).Width;
        }

        return _pageWidth;
    }

    float GetReportPageHeightInPixels()
    {
        float _pageHeight = 0;
        if (WebReport.SinglePage)
        {
            for (int i = 0; i < WebReport.Report.PreparedPages.Count; i++)
            {
                _pageHeight += WebReport.Report.PreparedPages.GetPageSize(i).Height;
            }
        }
        else
        {
            _pageHeight = WebReport.Report.PreparedPages.GetPageSize(WebReport.CurrentPageIndex).Height;
        }

        return _pageHeight;
    }

}
