Hi.
I have a blazor (razor) page and the following code on it:
<div id='documenteditor_titlebar' class="e-de-ctn-title">
<div class="single-line" id="documenteditor_title_contentEditor" style="border: 1px solid transparent;" title="Document Name." contenteditable="false">
<label id="documenteditor_title_name" class="doc-edit-title"> @documentName</label>
</div>
<div style="float: right">
<SfButton IconCss="e-de-icon-Download" CssClass="title-bar-btn" @onclick="OnExport">Exportar PDF</SfButton>
</div>
</div>
<div>
<SfDocumentEditorContainer EnableToolbar="false"
ShowPropertiesPane="false"
EnableComment="false"
EnableTrackChanges="false"
EnableCsp="false"
EnableLocalPaste="false"
RestrictEditing="true"
EnablePersistence="false"
EnableRtl="false"
EnableSpellCheck="false"
@ref="container"
Height="590px">
<DocumentEditorContainerEvents Created="OnCreated"></DocumentEditorContainerEvents>
</SfDocumentEditorContainer>
</div>
On code I have:
public async void OnExport(object args)
{
SfDocumentEditor documentEditor = container.DocumentEditor;
await documentEditor.SaveAsync(documentName, FormatType.Docx);
}
It's works fine. But I need to download in PDF format. I already found a link that shows a possible solution:
https://blazor.syncfusion.com/documentation/document-editor/how-to/export-document-as-pdf
But at least for me it didn't work (I don't know why, just appeared a lot of errors). Is there another solution?
Hi Wilton,
We have prepared a sample for your reference, and in this sample, we have exported the document as a pdf. Please find the attached sample for your reference.
Regards,
Selvaprakash K
Hi Wilton,
We saw the given video, and could you please share the image string you used to insert the image and also the input document (used jsonstring to open a document) you used to export the pdf? Thereby, we will analyse further and provide you with the appropriate solution at the earliest.
Hi.
See the attached file and if you need anything else just let me know.
Thanks.
Hi Wilton,
#exporting issue
We have tried to replicate the issue with the given SFDT data but couldn’t reproduce the issue. and we have attached the sample we used to try to replicate the issue. Please use the attached sample to check the exporting issue, and if the issue persists, could you please modify the attached sample to reproduce it and send it back? Thereby, we will analyze further and provide you with the appropriate solution at the earliest.
#image rendering issue
We have checked the given image string, and we suspect the given image string is not a proper base64 image string, so please share how you get this base64 string and refer to the attached HTML file.
About the exporting issue I'm still working out and I will send news to you soon.
About the image rendering issue I found the problem and the solution but know I have another problem.
It only works if I let the document editable. So I'm replacing everything that I need the the OnCreated Function. At the end of this I put:
container.RestrictEditing = true;
But it's not working. There is a place where I can put this code?
Something like AfterLoad?
About the exporting issue could you please give me a working sample Blazor WebAssembly App?
Because I already isolated everything and I'm still facing the problem.
I attached one but it needs some adjusts.
Hi Wilton,
Currently, we are preparing the sample in Blazor WebAssembly and will update the details on August 21.
Hi Wilton,
We have prepared a sample in Blazor WebAssembly to export a document as a pdf. Please refer to the attached sample.
Hi.
Just changed the license key.
Problem reproduced without changing the code.
See the attached video please.
Hi Wilton,
We were unable to reproduce the reported issue, and we have attached the video for your reference. Could you please try cleaning your project, deleting the bin\obj folders, and rebuilding your application, then check whether it resolves the issue?
Hi.
Same problem.
Cleaned, rebuilded, tried on firefox, chrome, edge and opera and same problems happens.
I'm using Visual Studio 2022 with your code and my license key (see below):
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("Ngo9BigBOggjHTQxAR8 / V1NGaF1cWGhAYVJyWmFZfV1gdV9DYlZQTGY / P1ZhSXxQdk1iXn5ddHdQT2dcUEw =");
Any ideas?
Hi Wilton,
We couldn't reproduce the issue on our end with the given key. This issue is not related to the license key. and we suspect the issue occurred due to the fact that the dll wasn't properly referenced, so please refer to the below UG documentation to know about exporting the document as a pdf using webassembly with a step-by-step process. Please refer to the below UG and try.
Convert Word to PDF in Blazor | DocIO | Syncfusion
Trying to solve the problem I also asked on StackOverflow and a comment appeared saying that will not work on WASM.
https://stackoverflow.com/questions/76971511/syncfusion-blazor-word-to-pdf
Is that right?
Hi Wilton,
We already shared a Blazor web assembly sample, and that is working properly on our end. We also shared the video in the previous update. Could you please share your system environment details? Based on that, we will check the reported issue in that same environment and share the details as soon as possible. additionally, please refer to our KB documentation to know about how to convert Word to PDF in the Blazor WASM app.
https://www.syncfusion.com/kb/13871/how-to-convert-word-to-pdf-in-blazor-webassembly-wasm
I decided to try another approach. Sended everything to the server and worked there. Now I think it's working the way I expected.
If I need any extra help I will let you know.
Thank you.
Hi Wilton,
Thanks for your update. Please let us know if you need any further assistance.
I've also got this issue trying to export to PDF. I've attached the error that I'm getting below. Was anyone able to figure out a solution or is sending it to a server the only way to handle it?
AP,
The reason for this issue is that the 'SkiaSharp' NuGet package is missing. Referencing this NuGet package should resolve the problem. Please refer the UG documentation.
We recommend you upgrade the latest version (v25.1.41) packages. Please upgrade and try on your end. Please cross-check that and let us know if there are any other issues or if you need further assistance.