BoldSign®Effortlessly integrate e-signatures into your app with the BoldSign® API. Create a sandbox account!
I am following code samples in this link - https://ej2.syncfusion.com/documentation/document-editor/saving-documents/server-side-export
But I am getting below error
System.Collections.Generic.KeyNotFoundException: 'The given key 'sfdt' was not present in the dictionary.'
My payload for post call is -
{
"content": "{\"sections\":[{\"blocks\":[{\"inlines\":[{\"characterFormat\":{\"bold\":true,\"italic\":true},\"text\":\"Hello World\"}]}],\"headersFooters\":{}}]}"
}
I have created sample application . there too I get same error . Sample code is this git repo -
https://github.com/kuntadynithesh/SyncDocTest
may I know whats wrong with code here ? Am I missing something ?
Hi Nithesh,
It seems that your
payload to endpoint is using the unoptimized form of SFDT structure. We suggest
you to convert the contents into optimize SFDT structure and let us know if you
face any further issues. Please refer to the provided documentation link on how
to optimize the SFDT structure.
https://ej2.syncfusion.com/aspnetcore/documentation/document-editor/how-to/optimize-sfdt
Regards,
Suresh I
Can you share a sample solution if you have . I am finding it hard to create one with optimized sfdt structure
Hi Nithesh,
Manual creation of SFDT file is not recommended. Document Editor have API to export to SFDT file for the document content that is currently visible in the editor. We suspect there is a misunderstanding on the SFDT file structure or the use case which you are trying is different. If yes, we could connect over a call to discuss about this. Please feel free to create a ticket in our support system.
Additionally, the SFDT which you are trying a very minimal SFDT which has only simple text and SFDT is complex structure which nested key and objects. Normally the input Word document are converted to SFDT using the server-side Core in EJ2 TypeScript Document editor control | Syncfusion and client-side opens the SFDT for rendering.
WordDocument document = WordDocument.Load(stream, FormatType.Docx); string json = Newtonsoft.Json.JsonConvert.SerializeObject(document); document.Dispose(); return json; |
The previously provided documentation is how to make the Document Editor generate SFDT in optimized and unoptimized mode. From version v21.1.x, the SFDT file generated in the Document Editor component is optimized by default to reduce the file size. All static keys are minified, and the final JSON string is compressed. This helps reduce the SFDT file size relative to a DOCX file.
UG: Optimize sfdt in EJ2 TypeScript Document editor control | Syncfusion
Regards,
could we please have a sample of angular document editor sending content to c# backend and save it as a docx format? and also sending it back to the front end editor.
Hi Christian Casal,
Please
find the attached angular sample link, and the web services project which contains the
API endpoints and the demo video in the Zip file.
Sample link: https://stackblitz.com/edit/angular-z5wqbm-rsmjdi?file=src%2Fapp.component.html,src%2Fapp.component.ts
Regards,
Suresh I
We successfully created a DOCX file from an optimized SFDT string. However, when I try to convert that saved DOCX file back into an SFDT format, the resulting SFDT is incorrect and doesn't represent the entire document. I've created a sample for this, with two APIs:
ExportSFDT (POST): This creates a DOCX file from the given SFDT string, and it works perfectly, generating the file locally.
LoadSFDT (GET): Here, I'm trying to convert the DOCX file back into an SFDT string and save it as another DOCX file to verify that the extracted SFDT is correct. However, the process fails because the resulting SFDT is not accurate.
Could you please review the code and help identify what might be going wrong?
Link to sample : https://github.com/saneeshdo/SyncFusionTest
Hi Nithesh,
We have checked your GitHub repository and made the necessary changes to convert the DOCX file into SFDT and save the SFDT back to a DOCX file. Please find the modified sample from the attachment.
Regards,
Aravind D
"The sfdtContent
retrieved in the LoadSFDT()
method appears quite different from the sfdtText
obtained through the ExportSFDT()
method. The content retrieved by LoadSFDT()
seems encrypted. How can I retrieve the sfdtText
in the same format that was originally used to create the sample.docx in the ExportSFDT()
method?"
Hi Nithesh,
You can retrieve the SFDT text without encryption. Please refer to the documentation below for instructions on how to optimize and unoptimize the SFDT text. We have also modified the sample for your reference. Please find it attached.
Documentation link: Optimize the SFDT file in Angular Document editor component | Syncfusion
Regards,
Aravind D