SpdfViewer2 problem on deploy app on azure
I migrate from blazorbootstrap pdf viewer.
I followed the non-trivial instructions to mount the SpdfViewer2 (nextgen) component on https://blazor.syncfusion.com/documentation/pdfviewer-2/getting-started/web-assembly-application but finally worked.
I used the component to display a very light pdf
The blazor bootstrap component takes less than a second to display it
SpdfViewer2 takes an average of 15 seconds to load the first time, faster for subsequent ones (I imagine I load libraries from the web).
However, when publishing the app on Azure, SpdfViewer2 remains stuck on loading. There are no errors on the console and the app remains active.
What did I do wrong?
Here my code
@using Syncfusion.Blazor.SfPdfViewer
...
@if (!string.IsNullOrEmpty(pdfBase64String))
{
<div class="row">
<SfPdfViewer2 DocumentPath="@string.Format("data:application/pdf;base64,{0}", pdfBase64String)"
Height="100%"
Width="100%"
@ref="Viewer">
</SfPdfViewer2>
</div>
}
@if (string.IsNullOrEmpty(pdfBase64String))
{
<div class="row">
<div class="col text-center">
<Spinner Color="SpinnerColor.Success" />
<h5>Caricamento in corso...</h5>
</div>
</div>
}
@code
{
SfPdfViewer2 Viewer;
...
protectedoverrideasync Task OnInitializedAsync()
{
if (!string.IsNullOrEmpty(myPDF))
{
pdfBase64String = myPDF;
}
}
Thanks!
Hi Renato Rolando,
Thank you for
reaching out. We have tested the same scenario by publishing the Blazor Wasm
sample to Azure, and the issue did not occur. The application rendered
correctly without any problems, and the PDF loaded quickly. For your reference,
we have provided both the local sample and the online Azure sample links below.
If you are still experiencing any issues, please provide a demo of the problem
you are encountering. Additionally, if any console errors occur, kindly share
those as well, so we can validate the issue and provide an appropriate
solution.
Azure online Sample
Local
PDF Viewer Sample
Regards,
Sathiyaseelan K
Dear Sathiyaseelan,
thank for your support.
With the last release - 27.1.51 - things are better.
My code still doesn't works: SfPdfViewer2 must be visibe before the file loading.
But is not a big problem.
Greetings
Renato
Hi Renato,
Could you please confirm if you are attempting to make the `SfPdfViewer2` visible before loading the file at the application level? Kindly share a sample project or code snippet to help us reproduce the issue, as this will enable us to troubleshoot and assist you more effectively.
- 3 Replies
- 3 Participants
-
RR renato rolando
- Sep 26, 2024 05:59 AM UTC
- Oct 2, 2024 02:54 PM UTC