diff --git a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img1.png b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img1.png new file mode 100644 index 000000000..4f5dd30ae Binary files /dev/null and b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img1.png differ diff --git a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img2.png b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img2.png new file mode 100644 index 000000000..3f468bd92 Binary files /dev/null and b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img2.png differ diff --git a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img3.png b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img3.png new file mode 100644 index 000000000..35e5200ae Binary files /dev/null and b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img3.png differ diff --git a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Linux_images/Linux_images_img4.png b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img4.png similarity index 100% rename from Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Linux_images/Linux_images_img4.png rename to Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img4.png diff --git a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img5.png b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img5.png new file mode 100644 index 000000000..93494379e Binary files /dev/null and b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img5.png differ diff --git a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img6.png b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img6.png new file mode 100644 index 000000000..1b2f3c449 Binary files /dev/null and b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img6.png differ diff --git a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Linux_images/Linux_images_img7.png b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img7.png similarity index 100% rename from Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Linux_images/Linux_images_img7.png rename to Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Mac_images/MacOS_images_img7.png diff --git a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/convert-excel-to-pdf-in-linux.md b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/convert-excel-to-pdf-in-linux.md index 0a2ab8c9f..92d36638b 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/convert-excel-to-pdf-in-linux.md +++ b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/convert-excel-to-pdf-in-linux.md @@ -26,9 +26,19 @@ Step 3: Select the framework and click **Create** button. ![Framework version](Linux_images/Linux_images_img3.png) -Step 4: Install the [Syncfusion.XlsIORenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIORenderer.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/). +Step 4: Install the following Nuget packages in your application from [NuGet.org](https://www.nuget.org/) by execute the following command. -![Install Syncfusion.XlsIORenderer.Net.Core NuGet Package](Linux_images/Linux_images_img4.png) +* [Syncfusion.XlsIORenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIORenderer.Net.Core) +* [SkiaSharp.NativeAssets.Linux](https://www.nuget.org/packages/SkiaSharp.NativeAssets.Linux/3.119.0) +* [HarfBuzzSharp.NativeAssets.Linux](https://www.nuget.org/packages/HarfBuzzSharp.NativeAssets.Linux/8.3.1.1) + +{% tabs %} +{% highlight KCONFIG %} +dotnet add package Syncfusion.XlsIO.Net.Core -v 29.1.41 -s https://www.nuget.org/ +dotnet add package SkiaSharp.NativeAssets.Linux -v 3.119.0 -s https://www.nuget.org/ +dotnet add package HarfBuzzSharp.NativeAssets.Linux -v 8.3.1.1 -s https://www.nuget.org/ +{% endhighlight %} +{% endtabs %} N> Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion® license key in your applications to use our components. @@ -91,12 +101,19 @@ dotnet new console -o Convert-Excel-to-PDF cd Convert-Excel-to-PDF ``` -Step 3: To **Convert an Excel document to PDF in .NET Core app**,run the following command to install [Syncfusion.XlsIORenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIORenderer.Net.Core) package. -![Install Syncfusion.XlsIORenderer.Net.Core Nuget Package](Linux_images/Linux_images_img7.png) +Step 3: Install the following Nuget packages in your application from [NuGet.org](https://www.nuget.org/) by execute the following command. -``` -dotnet add package Syncfusion.XlsIORenderer.Net.Core -``` +* [Syncfusion.XlsIORenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIORenderer.Net.Core) +* [SkiaSharp.NativeAssets.Linux](https://www.nuget.org/packages/SkiaSharp.NativeAssets.Linux/3.119.0) +* [HarfBuzzSharp.NativeAssets.Linux](https://www.nuget.org/packages/HarfBuzzSharp.NativeAssets.Linux/8.3.1.1) + +{% tabs %} +{% highlight KCONFIG %} +dotnet add package Syncfusion.XlsIO.Net.Core -v 29.1.41 -s https://www.nuget.org/ +dotnet add package SkiaSharp.NativeAssets.Linux -v 3.119.0 -s https://www.nuget.org/ +dotnet add package HarfBuzzSharp.NativeAssets.Linux -v 8.3.1.1 -s https://www.nuget.org/ +{% endhighlight %} +{% endtabs %} N> Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion® license key in your applications to use our components. diff --git a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/convert-excel-to-pdf-in-mac.md b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/convert-excel-to-pdf-in-mac.md new file mode 100644 index 000000000..0e8b8b1f7 --- /dev/null +++ b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/convert-excel-to-pdf-in-mac.md @@ -0,0 +1,156 @@ +--- +title: Convert an Excel document to PDF on Mac | Syncfusion +description: Convert an Excel document to PDF on Mac using Syncfusion .NET Core Excel library (XlsIO) without Microsoft Office +platform: document-processing +control: XlsIO +documentation: UG +--- +# Convert an Excel document to PDF on Mac + +Syncfusion® XlsIO is a [.NET Core Excel library](https://www.syncfusion.com/document-processing/excel-framework/net-core/excel-library) used to create, read, edit and **convert Excel documents** programmatically without **Microsoft Excel** or interop dependencies. Using this library, you can **convert an Excel document to PDF on Mac**. + +## Steps to convert an Excel document to PDF on Mac + +{% tabcontents %} + +{% tabcontent Visual Studio %} + +Step 1: Create a new C# .NET Core console application. +![Create .NET Core console project in Visual Studio](Mac_images/MacOS_images_img1.png) + +Step 2: Name the project. + +![Name the project](Mac_images/MacOS_images_img2.png) + +Step 3: Select the framework and click **Create** button. + +![Framework version](Mac_images/MacOS_images_img3.png) + +Step 4: Install the [Syncfusion.XlsIORenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIORenderer.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/). + +![Install Syncfusion.XlsIORenderer.Net.Core NuGet Package](Mac_images/MacOS_images_img4.png) + +N> Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion® license key in your applications to use our components. + +Step 5: Include the following Namespaces in the Program.cs file. +{% tabs %} +{% highlight c# tabtitle="C#" %} +using Syncfusion.XlsIO; +using Syncfusion.XlsIORenderer; +using Syncfusion.Pdf; +{% endhighlight %} +{% endtabs %} + +Step 6: Add the following code snippet in Program.cs file. +{% tabs %} +{% highlight c# tabtitle="C#" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + + //Load existing Excel file + FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Sample.xlsx"), FileMode.Open, FileAccess.Read); + IWorkbook workbook = application.Workbooks.Open(inputStream); + + //Convert to PDF + XlsIORenderer renderer = new XlsIORenderer(); + PdfDocument pdfDocument = renderer.ConvertToPDF(workbook); + + //Create the MemoryStream to save the converted PDF. + MemoryStream pdfStream = new MemoryStream(); + + #region Save + //Saving the workbook + FileStream outputStream = new FileStream(Path.GetFullPath("Output/Sample.pdf"), FileMode.Create, FileAccess.Write); + pdfDocument.Save(outputStream); + #endregion + + //Dispose streams + outputStream.Dispose(); + inputStream.Dispose(); +} +{% endhighlight %} +{% endtabs %} + +{% endtabcontent %} + +{% tabcontent Visual Studio Code %} + +Step 1: Create a new C# .NET Core console application. +![Create .NET Core console project in Visual Studio Code](Mac_images/MacOS_images_img5.png) + +Step 2: Name the project and create the project. + +![Name the project](Mac_images/MacOS_images_img6.png) + +Alternatively, create a ASP.NET Core console application using the following command in the terminal(Ctrl+`). + +``` +dotnet new console -o Convert-Excel-to-PDF +cd Convert-Excel-to-PDF +``` + +Step 3: To **Convert an Excel document to PDF in .NET Core app**,run the following command to install [Syncfusion.XlsIORenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIORenderer.Net.Core) package. +![Install Syncfusion.XlsIORenderer.Net.Core Nuget Package](Mac_images/MacOS_images_img7.png) + +``` +dotnet add package Syncfusion.XlsIORenderer.Net.Core +``` + +N> Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion® license key in your applications to use our components. + +Step 4: Include the following Namespaces in the Program.cs file. +{% tabs %} +{% highlight c# tabtitle="C#" %} +using Syncfusion.XlsIO; +using Syncfusion.XlsIORenderer; +using Syncfusion.Pdf; +{% endhighlight %} +{% endtabs %} + +Step 5: Add the following code snippet in Program.cs file. +{% tabs %} +{% highlight c# tabtitle="C#" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + + //Load existing Excel file + FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Sample.xlsx"), FileMode.Open, FileAccess.Read); + IWorkbook workbook = application.Workbooks.Open(inputStream); + + //Convert to PDF + XlsIORenderer renderer = new XlsIORenderer(); + PdfDocument pdfDocument = renderer.ConvertToPDF(workbook); + + //Create the MemoryStream to save the converted PDF. + MemoryStream pdfStream = new MemoryStream(); + + #region Save + //Saving the workbook + FileStream outputStream = new FileStream(Path.GetFullPath("Output/Sample.pdf"), FileMode.Create, FileAccess.Write); + pdfDocument.Save(outputStream); + #endregion + + //Dispose streams + outputStream.Dispose(); + inputStream.Dispose(); +} +{% endhighlight %} +{% endtabs %} + +{% endtabcontent %} + +{% endtabcontents %} + +A complete working example of how to convert an Excel document to PDF on Mac is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Getting%20Started/Mac/Convert%20Excel%20to%20PDF). + +By executing the program, you will get the **PDF document** as follows. + +![Output File](ASP-NET-Core_images\ASP-NET-Core_images_img9.png) + +Click [here](https://www.syncfusion.com/document-processing/excel-framework/net-core) to explore the rich set of Syncfusion® Excel library (XlsIO) features. + +An online sample link to [convert an Excel document to PDF](https://ej2.syncfusion.com/aspnetcore/Excel/ExcelToPDF#/material3) in ASP.NET Core. \ No newline at end of file