1. Tag Results
convert-word-to-pdf (3)
1 - 3 of 3
Converting Word document to PDF in ASP.NET Core
​Syncfusion® Essential® DocIO Renderer is a .NET Core Word to PDF conversion library (Essential® DocIO and Essential® PDF) used to convert Word documents to PDF in ASP.NET Core application [C#]. Steps to convert Word document to PDF programmatically in ASP.NET Core: Create new C# .NET Core console application. Install the Syncfusion.DocIORenderer.NET.Core NuGet package as a reference to your .NET Core application from NuGet.org. Include the following namespace in the Program.cs file. C# using Syncfusion.DocIO.DLS; using Syncfusion.DocIORenderer; using Syncfusion.Pdf; using System.IO; Use the following code snippet to create Word document with “Hello World” text and convert Word document to PDF. C# //Creates a new Word document. WordDocument wordDocument = new WordDocument(); //Add a section & a paragraph in the empty document. wordDocument.EnsureMinimal(); //Append text to the last paragraph of the document. wordDocument.LastParagraph.AppendText("Hello World...!"); //Create instance for DocIORenderer for Word to PDF conversion DocIORenderer render = new DocIORenderer(); //Converts Word document to PDF. PdfDocument pdfDocument = render.ConvertToPDF(wordDocument); //Release the resources used by the Word document and DocIO Renderer objects. render.Dispose(); wordDocument.Dispose(); //Saves the PDF file. FileStream outputStream = new FileStream(@"Ouput.pdf", FileMode.CreateNew, FileAccess.Write); pdfDocument.Save(outputStream); //Closes the instance of PDF document object. pdfDocument.Close(); //Dispose the instance of FileStream. outputStream.Dispose(); A complete working example of how to convert Word document to PDF using .NET Core Word library can be downloaded from WordToPDF_Example.Zip. By executing the example program, you will get the PDF document as like below.  Take a moment to peruse the documentation, where you can find other file format conversions with code examples and the procedure to deploy the application in Linux OS.Explore more about the rich set of Syncfusion® Word Framework features.An online example to convert Word document to PDF in ASP.NET Core web application.Note:Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion® license key in your application to use the components without trial message.
How to convert Word document to PDF in UWP?
Syncfusion® Essential® DocIO Renderer is a .NET Core Word to PDF conversion library allows you to convert Word document to PDF in UWP application [C#]. Steps to convert Word document to PDF programmatically in UWP: Create a new C# Blank App (Universal Windows) project. Install the Syncfusion.DocIORenderer.NET.Core NuGet package as a reference to your UWP application from NuGet.org. Add a new button in the MainPage.xaml as shown below. XAML <Page    x:Class="WordToPDF.MainPage"    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    xmlns:local="using:WordToPDF"    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"    mc:Ignorable="d"    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">     <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">         <Button x:Name="button" Content="Generate PDF" Click="OnButtonClicked" HorizontalAlignment="Center" VerticalAlignment="Center"/>     </Grid> </Page> Include the following namespaces in the Mainpage.xaml.cs file. C# using Syncfusion.DocIO.DLS; using Syncfusion.DocIORenderer; using Syncfusion.Pdf;   Include the below code snippet in the click event of the button in MainPage.xaml.cs, to convert a Word document to PDF and save the PDF document as a physical file and open the file for viewing. C# private async void OnButtonClicked(object sender, RoutedEventArgs e) {     //Creates an instance of WordDocument Instance (Empty Word Document)     WordDocument wordDocument = new WordDocument();     //Add a section and a paragraph in the empty document     wordDocument.EnsureMinimal();     //Append text to the last paragraph of the document     wordDocument.LastParagraph.Text = "Adventure Works Cycles, the fictitious company on which the" + " AdventureWorks sample databases are based, is a large, multinational manufacturing company. ";     //Instantiation of DocIORenderer for Word to PDF conversion     DocIORenderer render = new DocIORenderer();     //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();     outputStream.Position = 0;     //Save the PDF file     SavePDF(outputStream); }   private async void SavePDF(Stream outputStream) {     StorageFile stFile;     if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")))     {       FileSavePicker savePicker = new FileSavePicker();       savePicker.DefaultFileExtension = ".pdf";       savePicker.SuggestedFileName = "Sample";       savePicker.FileTypeChoices.Add("Adobe PDF Document", new List<string>() { ".pdf" });       stFile = await savePicker.PickSaveFileAsync();     }     else     {       StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder; stFile = await local.CreateFileAsync("Sample.pdf", CreationCollisionOption.ReplaceExisting);     }     if (stFile != null)     {       Windows.Storage.Streams.IRandomAccessStream fileStream = await stFile.OpenAsync(FileAccessMode.ReadWrite);       Stream st = fileStream.AsStreamForWrite();       st.SetLength(0);       st.Write((outputStream as MemoryStream).ToArray(), 0, (int)outputStream.Length);       st.Flush();       st.Dispose();       fileStream.Dispose();       MessageDialog msgDialog = new MessageDialog("Do you want to view the Document?", "File created.");       UICommand yesCmd = new UICommand("Yes");       msgDialog.Commands.Add(yesCmd);       UICommand noCmd = new UICommand("No");       msgDialog.Commands.Add(noCmd);       IUICommand cmd = await msgDialog.ShowAsync();       if (cmd == yesCmd)       {           // Launch the retrieved file           bool success = await Windows.System.Launcher.LaunchFileAsync(stFile);       }     } }   A complete working example of how to convert Word document to PDF in UWP using .NET Core Word to PDF conversion library can be downloaded from Word to PDF in UWP.zip. Take a moment to peruse the documentation, where you can find basic Word document processing options along with features like mail merge, merge and split documents, find and replace text in the Word document and protect the Word documents with code examples. Explore more about the rich set of Syncfusion® Word Framework features. See Also: Create Word document in UWP Mail merge Word document in UWP Note: As per MSDN announcement, the minimum version of UWP project must be Fall Creators Update (FCU). Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion® license key in your application to use the components without trail message.  
How to convert a Word document to PDF in ASP.NET Core?
Syncfusion® Essential® DocIO Renderer is a .NET Core Word to PDF conversion library (Essential® DocIO and Essential® PDF) used to convert Word documents to PDF in ASP.NET Core application [C#]. Steps to convert Word document to PDF programmatically in ASP.NET Core: Create new C# .NET Core console application. Install the Syncfusion.DocIORenderer.NET.Core NuGet package as a reference to your .NET Core application from NuGet.org. Include the following namespace in the Program.cs file. C# using Syncfusion.DocIO.DLS; using Syncfusion.DocIORenderer; using Syncfusion.Pdf; using System.IO; Use the following code snippet to create Word document with “Hello World” text and convert Word document to PDF. C# //Creates a new Word document. WordDocument wordDocument = new WordDocument(); //Add a section & a paragraph in the empty document. wordDocument.EnsureMinimal(); //Append text to the last paragraph of the document. wordDocument.LastParagraph.AppendText("Hello World...!"); //Create instance for DocIORenderer for Word to PDF conversion DocIORenderer render = new DocIORenderer(); //Converts Word document to PDF. PdfDocument pdfDocument = render.ConvertToPDF(wordDocument); //Release the resources used by the Word document and DocIO Renderer objects. render.Dispose(); wordDocument.Dispose(); //Saves the PDF file. FileStream outputStream = new FileStream(@"Ouput.pdf", FileMode.CreateNew, FileAccess.Write); pdfDocument.Save(outputStream); //Closes the instance of PDF document object. pdfDocument.Close(); //Dispose the instance of FileStream. outputStream.Dispose(); A complete working example of how to convert Word document to PDF using .NET Core Word library can be downloaded from WordToPDF_Example.Zip. By executing the example program, you will get the PDF document as like below. Take a moment to peruse the documentation, where you can find other file format conversions with code examples and the procedure to deploy the application in Linux OS. Explore more about the rich set of Syncfusion® Word Framework features. An online example to convert Word document to PDF in ASP.NET Core web application. Note:Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion® license key in your application to use the components without trail message.  ConclusionI hope you enjoyed learning about how to convert a Word document to PDF in ASP.NET Core.You can refer to our ASP.NET Core Word feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our ASP.NET Core Word example to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
No articles found
No articles found
1 of 1 pages (3 items)