Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
146533 | Aug 7,2019 11:58 AM UTC | Aug 23,2019 06:42 PM UTC | ASP.NET Core - EJ 2 | 7 |
![]() |
Tags: DocIO |
//Loads an existing Word document
WordDocumentwordDocument = newWordDocument("Sample.docx", FormatType.Docx); //Initializes the ChartToImageConverter for converting charts during Word to pdf conversion wordDocument.ChartToImageConverter = newChartToImageConverter(); //Creates an instance of the DocToPDFConverter - responsible for Word to PDF conversion DocToPDFConverterconverter = newDocToPDFConverter(); //Sets true to enable fast rendering . converter.Settings.EnableFastRendering = true; //Sets a value indicating whether to optimize the memory usage for the identical images in Word to PDF conversion . converter.Settings.OptimizeIdenticalImages = true; //Converts Word document into PDF document PdfDocumentpdfDocument = converter.ConvertToPDF(wordDocument); //Saves the PDF file to file system pdfDocument.Save("WordtoPDF.pdf"); //Closes the instance of document objects pdfDocument.Close(true); wordDocument.Close(); |
FileStream docStream = new FileStream(@"Template.docx", FileMode.Open, FileAccess.Read); //Loads file stream into Word document WordDocument wordDocument = new WordDocument(docStream, Syncfusion.DocIO.FormatType.Automatic); //Instantiation of DocIORenderer for Word to PDF conversion DocIORenderer render = new DocIORenderer(); //Sets true to optimize the memory usage for identical images render.Settings.OptimizeIdenticalImages = true; //Converts Word document into PDF document PdfDocument pdfDocument = render.ConvertToPDF(wordDocument); //Releases all resources used by the Word document and DocIO Renderer objects render.Dispose(); wordDocument.Dispose(); //Saves the PDF file MemoryStream outputStream = new MemoryStream(); pdfDocument.Save(outputStream); //Closes the instance of PDF document object pdfDocument.Close(); |
//Loads an existing Word document WordDocumentwordDocument = newWordDocument("Sample.docx",FormatType.Docx); //Initializes the ChartToImageConverter for converting charts during Word to pdf conversion wordDocument.ChartToImageConverter = newChartToImageConverter(); //Creates an instance of the DocToPDFConverter - responsible for Word to PDF conversion DocToPDFConverterconverter = newDocToPDFConverter(); //Sets true to enable fast rendering . converter.Settings.EnableFastRendering = true; //Sets a value indicating whether to optimize the memory usage for the identical images in Word to PDF conversion . converter.Settings.OptimizeIdenticalImages = true; //Converts Word document into PDF document PdfDocumentpdfDocument = converter.ConvertToPDF(wordDocument); //Saves the PDF file to file system pdfDocument.Save("WordtoPDF.pdf"); //Closes the instance of document objects pdfDocument.Close(true); wordDocument.Close(); |
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.