Skip to content

842227-Prepare UG to convert Excel file to PDF in Mac using XlsIO #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Getting Started/Mac/Convert Excel to PDF/Convert Excel to PDF.sln
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Convert_Excel_to_PDF</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.XlsIORenderer.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Output\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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();

}
}
}
}