Hi. I'm having an issue related to this question https://www.syncfusion.com/forums/167785/trying-to-convert-word-doc-to-pdf. The winform solution works great locally, but once I deployed it into an azure function I'm seeing the corrupted images again. The flow is:
If I call this function locally it works flawlessly, but in the hosted version the corrupt image (red X) appears again. Another interesting thing to note is the page layout also changes, some text moves to different pages, and the overall quality of the converted document seems to get worse, again only in the hosted version.
I was inspecting the base64 string that the local and hosted version produces and the hosted version produces a much shorter base64 string, almost as if it was truncated. Additionally, I can take both base64 strings and read them into a file locally and again the hosted version displays the corrupted image where the local version displays the correct image.
Could this possibly be because I'm still using the free version of syncfusion? We are planning on purchasing it, but we just haven't done so yet because we're still in the evaluation process. Thank you for your help!
I also tried doing the conversion process in another function using the .Net framework, but the images still appear as red X's. Again though, if I run the .Net framework function locally everything works.
Hi Lokesh!
If I use the Azure Cloud Service will I still need to convert to JPEG or PNG first? Also, if possible, could you explain why you suggest using the Azure Cloud Service? Is it for performance?
I can try to figure it out myself, but would it be possible for you to provide an example of how to convert the .emf/.wmf images to JPEG/PNG? I can't convert them directly in the word document as they are coming from outside sources. So is there a way to convert them with SyncFusion?
Thank you for the quick reply and all of your help!
The cloud service in the .Net framework is working flawlessly! Thank you for your help!
Quick question is there anyway to speed up the conversion process?
//Creates an Word document instance
WordDocument wordDocument = new WordDocument();
//Sets flag to preserve embedded Ole image as normal image while opening document
wordDocument.Settings.PreserveOleImageAsImage = true;
//Loads or opens an existing Word document
wordDocument.Open("Template.docx", FormatType.Docx);
//Initializes the ChartToImageConverter for converting charts during Word to pdf conversion
wordDocument.ChartToImageConverter = new ChartToImageConverter();
//Creates an instance of the DocToPDFConverter
DocToPDFConverter converter = new DocToPDFConverter();
//Sets the flag to optimize memory usage of identical (duplicate)
converter.Settings.OptimizeIdenticalImages = true;
//Converts Word document into PDF document
PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument);
//Dispose the resources
converter.Dispose();
//Saves the PDF file
pdfDocument.Save("WordtoPDF.pdf");
//Closes the instance of document objects
pdfDocument.Close(true);
wordDocument.Close(); |
Thanks Lokesh! I'll check this out and let you know.