Hi,
from your documentation, it's not clear what is the best solution in a scenario like this:
- Blazor Webassembly application Hosted (client dashboard and server API)
- convert some of the dashboard pages in one PDF with almost the same content (user request pressing a button)
- each page contains text, charts and grids (syncfusion blazor components)
Essential PDF
From documentation:
you can recreate every page adding manually again each text and table. But what about charts? I didn't find any help document about that.
Moreover, this solution requires rewriting all the dashboard pages and positioning manually each component. Is it right?
HTML to PDF Converter
From documentation:
Converting HTML to PDF with WebKit engine | Syncfusion
It's not clear if the solution works in a Webassembly Balzor app. If not, is there a workaround? For example, using the server-side of the hosted application.
Using this solution, can you convert directly the dashboard pages and their content (maybe with another main layout) ?
I know there are specific WebKit libraries for windows/linux/mac, but which one do I have to use? Especially if the development environment is a Windows PC/Server, but the production one is a Linux Docker image.
Queries |
Response |
Queries regarding Essential PDF |
You can create pages with text and table, you can add the charts as images in PDF pages. Yes, you need to create and add the components from dashboard page to PDF page by positioning manually.
Please refer below links for more information,
|
Queries regarding HTML to PDF converter |
Our HTML to PDF converter will only in Blazor server side app. Using HTML to PDF converter, we can render the dashboard page to PDF document directly.
Yes, we have specific binaries based on the platform. You can use it based on your development and production environment.
If you are using windows for development environment, you need to choose windows binaries. When you are moving to production, you need to choose Linux binaries. Please refer below links for more information about HTML to PDF conversion in Blazor and Linux docker.
|
Hi,
thanks for the links.
About Essential PDF, the example implements a winform solution. In our case, we work with a Blazor WebAssembly Hosted application and it's mean the execution of the code is client-side:
- is still valid the example? I mean, can I use the same library/methods in a Blazor context?
- the PDF creation is in background: there are no controls "to export from a page", but we should create them dynamically by code in the background and insert them into the pdf to send back to the user. Is still possible?
The HTML to PDF conversion is clear, but probably less useful in this context.
Regards.
Hi,
this is clear. Let's try with an example. If I have to put a chart on a Blazor page, I write a code like this one:
<SfChart>
<ChartEvents OnAxisLabelRender="onChartAxisLabelRender"></ChartEvents>
<ChartLegendSettings Visible="true" Position="LegendPosition.Top" Alignment="Alignment.Far" Height="10%">
<ChartLegendTextStyle FontFamily="Roboto" FontWeight="500" Size="10px"></ChartLegendTextStyle>
</ChartLegendSettings>
<ChartArea><ChartAreaBorder Width="0"></ChartAreaBorder></ChartArea>
<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.DateTime" LabelFormat="dd/MM/yyyy" IntervalType="IntervalType.Days" LabelIntersectAction="LabelIntersectAction.Rotate45" EdgeLabelPlacement="EdgeLabelPlacement.Hide">
<ChartAxisMajorGridLines Width="0"></ChartAxisMajorGridLines>
<ChartAxisLabelStyle FontFamily="Roboto" FontWeight="500" Size="10px"></ChartAxisLabelStyle>
</ChartPrimaryXAxis>
<ChartPrimaryYAxis>
<ChartAxisLabelStyle FontFamily="Roboto" FontWeight="500" Size="10px"></ChartAxisLabelStyle>
<ChartAxisMajorTickLines Width="0"></ChartAxisMajorTickLines>
<ChartAxisLineStyle Width="0"></ChartAxisLineStyle>
</ChartPrimaryYAxis>
<ChartSeriesCollection>
<ChartSeries DataSource="@_chartserie" Name="CASHFLOW" XName="Date" Opacity="0.7" YName="Value" Fill="Color" Type="ChartSeriesType.Area" TooltipMappingName="Label">
</ChartSeries>
</ChartSeriesCollection>
</SfChart>
Now I want to create dynamically on a server-side API the same chart by code, export it in an image to put in a PDF/Word. Can I write a code like:
SfChart chart = new SfChart();
ChartSeries series = new ChartSeries(chart);
series.Type = ChartSeriesType.Area;
(...)
chart.Export(ExportType.JPEG, "chart.png");
and then using the image in a PDF/Word?
Thanks
Ok, thank you. It's clear.
We will find another solution.
Regards.