api export

Hi,

Using the docker image documenteditor, I'm trying to use the Export api for PDF return type:

const handlePDFConversion = async () => {
const documentEditor = ref.current;
documentEditor.saveAsBlob('Docx')
.then((blobDocx) => {
const file = new File([blobDocx], "myCurrentDoc.docx");
const formData = new FormData;
formData.append('files', file);
formData.append('fileName', "MyCurrentDocAsPDF.pdf");

$postBlob('http://localhost:6002/api/documenteditor/Export', formData)
.then((blob) => {
console.log(blob);
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.rel='nofollow' href = url;
link.setAttribute('download', 'MyCurrentDocAsPDF.pdf');
document.body.appendChild(link);
link.click();
});
});
}


Using this way, the returned blob has always size : 0, and the created PDF is corrupted.


in my headers I set Accept: 'application/pdf'

and responseType: 'blob'



Do you know what I'm doing wrong?

trying to append filename as '.html' results in error.


regards,

Francois


4 Replies 1 reply marked as answer

SM Suriya Murugan Syncfusion Team December 16, 2021 11:48 AM UTC

Hi Francois, 

Syncfusion Greetings! 

We will check the provided code snippet and will share details by December 17,2021. 

Regards, 
Suriya M. 



SM Suriya Murugan Syncfusion Team December 17, 2021 07:23 AM UTC

Hi , 

Apologies! 

We are facing issue on using Pdf and have to modify the Pdf export in Docker source and its throwing error. In mean time, You can check below documentation to know more about Pdf export: 


Add the same in docker source.  
Please check below sample how to use type to download document: 


Check line number: 269 in status-bar.ts file. 

Regards, 
Suriya M. 


Marked as answer

JW Jarred Witt November 29, 2023 03:18 AM UTC

Has the issue with exporting to a PDF using the /Export endpoint been fixed yet? We're using the docker image for our word processor and we're seeing the same issue. The blob comes back with 0 bytes and the PDF is corrupt.



KD Kesavan D Syncfusion Team November 29, 2023 02:17 PM UTC

Regarding the issue you reported in your query, we would like to clarify that the public docker for the word processor does not support exporting PDF. Therefore, we have integrated an export PDF feature and attached a sample for your requirement. Please use the attached project with Export web action updated with PDF Exporting(Converting to requires additional Syncfusion.DocIORenderer.Net.Core nuget to be added)



Attachment: WordProcessorServerDocker_cb859b5d_e7e6f5d6.zip

Loader.
Up arrow icon