diff --git a/Getting Started/Mac/Convert Excel to PDF/Convert Excel to PDF.sln b/Getting Started/Mac/Convert Excel to PDF/Convert Excel to PDF.sln new file mode 100644 index 00000000..400cce74 --- /dev/null +++ b/Getting Started/Mac/Convert Excel to PDF/Convert Excel to PDF.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35506.116 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Convert Excel to PDF", "Convert Excel to PDF\Convert Excel to PDF.csproj", "{B140AF40-CDDD-41ED-9382-5568B4D0D421}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B140AF40-CDDD-41ED-9382-5568B4D0D421}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B140AF40-CDDD-41ED-9382-5568B4D0D421}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B140AF40-CDDD-41ED-9382-5568B4D0D421}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B140AF40-CDDD-41ED-9382-5568B4D0D421}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Getting Started/Mac/Convert Excel to PDF/Convert Excel to PDF/Convert Excel to PDF.csproj b/Getting Started/Mac/Convert Excel to PDF/Convert Excel to PDF/Convert Excel to PDF.csproj new file mode 100644 index 00000000..6bc86619 --- /dev/null +++ b/Getting Started/Mac/Convert Excel to PDF/Convert Excel to PDF/Convert Excel to PDF.csproj @@ -0,0 +1,21 @@ + + + + Exe + net8.0 + Convert_Excel_to_PDF + enable + enable + + + + + + + + + Always + + + + diff --git a/Getting Started/Mac/Convert Excel to PDF/Convert Excel to PDF/Data/Sample.xlsx b/Getting Started/Mac/Convert Excel to PDF/Convert Excel to PDF/Data/Sample.xlsx new file mode 100644 index 00000000..e94fa38b Binary files /dev/null and b/Getting Started/Mac/Convert Excel to PDF/Convert Excel to PDF/Data/Sample.xlsx differ diff --git a/Getting Started/Mac/Convert Excel to PDF/Convert Excel to PDF/Output/.gitkeep b/Getting Started/Mac/Convert Excel to PDF/Convert Excel to PDF/Output/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Getting Started/Mac/Convert Excel to PDF/Convert Excel to PDF/Program.cs b/Getting Started/Mac/Convert Excel to PDF/Convert Excel to PDF/Program.cs new file mode 100644 index 00000000..4ae2bd72 --- /dev/null +++ b/Getting Started/Mac/Convert Excel to PDF/Convert Excel to PDF/Program.cs @@ -0,0 +1,40 @@ +using Syncfusion.XlsIO; +using Syncfusion.XlsIORenderer; +using Syncfusion.Pdf; + +namespace Excel_to_PDF_Mac +{ + class Program + { + static void Main(string[] args) + { + using (ExcelEngine excelEngine = new ExcelEngine()) + { + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + + //Load existing Excel file + FileStream inputStream = new FileStream("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(); + + } + } + } +} \ No newline at end of file