Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
142060 | Jan 17,2019 04:39 AM UTC | Jan 17,2019 11:47 AM UTC | Angular - EJ 2 | 1 |
![]() |
Tags: DocumentEditor |
public IActionResult DocToPDF(IFormCollection data)
{
Stream stream = new MemoryStream();
IFormFile file = data.Files[0];
var fileName = file.FileName;
file.CopyTo(stream);
stream.Position = 0;
Syncfusion.DocIO.DLS.WordDocument wordDocument = newSyncfusion.DocIO.DLS.WordDocument(stream, Syncfusion.DocIO.FormatType.Docx);
//Instantiation of DocIORenderer for Word to PDF conversion
DocIORenderer render = new DocIORenderer();
//Converts Word document into PDF document
PdfDocument pdfDocument = render.ConvertToPDF(wordDocument);
//Saves the PDF file
MemoryStream outputStream = new MemoryStream();
pdfDocument.Save(outputStream);
//Closes the instance of PDF document object
outputStream.Position = 0;
render.Dispose();
wordDocument.Dispose();
return File(outputStream, "application/pdf", fileName + ".pdf");
}
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.