From 2ed96f184bb0a06516f3cafb6be34bb95f657e3a Mon Sep 17 00:00:00 2001 From: KurmithaSF4004 Date: Wed, 25 Oct 2023 20:38:28 +0530 Subject: [PATCH] Convert Excel to PDF in AWS Lambda --- .../Convert-Excel-to-PDF.sln | 25 ++++++ .../Convert-Excel-to-PDF.csproj | 28 +++++++ .../Data/InputTemplate.xlsx | Bin 0 -> 12260 bytes .../Convert-Excel-to-PDF/Function.cs | 74 ++++++++++++++++++ .../Properties/launchSettings.json | 10 +++ .../Convert-Excel-to-PDF/Readme.md | 49 ++++++++++++ .../aws-lambda-tools-defaults.json | 16 ++++ .../Convert-Excel-to-PDF.sln | 25 ++++++ .../Convert-Excel-to-PDF/App.config | 6 ++ .../Convert-Excel-to-PDF.csproj | 67 ++++++++++++++++ .../Convert-Excel-to-PDF/Program.cs | 51 ++++++++++++ .../Properties/AssemblyInfo.cs | 36 +++++++++ .../Convert-Excel-to-PDF/packages.config | 6 ++ 13 files changed, 393 insertions(+) create mode 100644 Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF.sln create mode 100644 Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/Convert-Excel-to-PDF.csproj create mode 100644 Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/Data/InputTemplate.xlsx create mode 100644 Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/Function.cs create mode 100644 Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/Properties/launchSettings.json create mode 100644 Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/Readme.md create mode 100644 Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/aws-lambda-tools-defaults.json create mode 100644 Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF.sln create mode 100644 Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/App.config create mode 100644 Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/Convert-Excel-to-PDF.csproj create mode 100644 Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/Program.cs create mode 100644 Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/Properties/AssemblyInfo.cs create mode 100644 Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/packages.config diff --git a/Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF.sln b/Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF.sln new file mode 100644 index 00000000..00a3e3aa --- /dev/null +++ b/Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34202.233 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Convert-Excel-to-PDF", "Convert-Excel-to-PDF\Convert-Excel-to-PDF.csproj", "{295165D4-3BDB-45E4-A774-522E24975473}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {295165D4-3BDB-45E4-A774-522E24975473}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {295165D4-3BDB-45E4-A774-522E24975473}.Debug|Any CPU.Build.0 = Debug|Any CPU + {295165D4-3BDB-45E4-A774-522E24975473}.Release|Any CPU.ActiveCfg = Release|Any CPU + {295165D4-3BDB-45E4-A774-522E24975473}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8E30ABC3-6970-4FA5-A64F-C532FD607D69} + EndGlobalSection +EndGlobal diff --git a/Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/Convert-Excel-to-PDF.csproj b/Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/Convert-Excel-to-PDF.csproj new file mode 100644 index 00000000..de400412 --- /dev/null +++ b/Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/Convert-Excel-to-PDF.csproj @@ -0,0 +1,28 @@ + + + net6.0 + enable + enable + true + Lambda + + true + + true + + + + + + + PreserveNewest + + + + + + + + + + \ No newline at end of file diff --git a/Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/Data/InputTemplate.xlsx b/Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/Data/InputTemplate.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..e94fa38b48e4db83d1c11d199d8da684f3e5d900 GIT binary patch literal 12260 zcmeHt1zVfh)^>0$?ykk%p+L}L#i3Ynio0uZcM24DcP;KMuEiufW!bm17HCF04d-YHmEHa3;=+H1_00ju;7{^)>aNiRt`GK zt~N&Y9~fOMEl9EthQAeZ*?gBcqf>r?!lwBd)e(&hlBHFun(+_@+F@iX-zh6WytRJKoPw za7ou3trPhW!pw#YE$wjQW>__wx?ZVC(NkHeNe*`SL6pw(5wcuy)b{+maH)z(w2ey} z7jnlF$aLsQ{owu^Ff6mfLYJRs+pV#Um)T#AM(dR0=X3nl1;M_!stmx&nSLBrxWwdi`p%^`EwMc zhJqU&MQx?vzM}XQ53ps_aaCk82q7|rplI%^8bTbNv!_Fxc^MAfNSndb)i^nj?L9w3 z0ObEh;5rp%@(a)>G9Z2;fC#K(XJlc|#Q5v^f5iPSX6wIgy)^cnTsJdf;IYI*P~Y{` zVl;}dw6l;zGpVwdx8zUcx`-SK{Ka-E0u*IDKZv)VTD=|y78c(`?Ddget+AJep<(cm z*E^R5C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da/Convert Excel to PDF/Convert-Excel-to-PDF/Function.cs new file mode 100644 index 00000000..fbdfcc29 --- /dev/null +++ b/Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/Function.cs @@ -0,0 +1,74 @@ +using Amazon.Lambda.Core; +using Syncfusion.XlsIO; +using Syncfusion.XlsIORenderer; +using Syncfusion.Pdf; +using Syncfusion.XlsIO.Implementation; +// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class. +[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] + +namespace Convert_Excel_to_PDF +{ + public class Function + { + + /// + /// A simple function that takes a string and does a ToUpper + /// + /// + /// + /// + public string FunctionHandler(string input, ILambdaContext context) + { + using (ExcelEngine excelEngine = new ExcelEngine()) + { + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + + //Initializes the SubstituteFont event to perform font substitution during Excel-to-PDF conversion + application.SubstituteFont += new SubstituteFontEventHandler(SubstituteFont); + + FileStream excelStream = new FileStream(@"Data/InputTemplate.xlsx", FileMode.Open, FileAccess.Read); + IWorkbook workbook = application.Workbooks.Open(excelStream); + + //Initialize XlsIO renderer. + XlsIORenderer renderer = new XlsIORenderer(); + + //Convert Excel document into PDF document + PdfDocument pdfDocument = renderer.ConvertToPDF(workbook); + + //Create the MemoryStream to save the converted PDF. + MemoryStream pdfStream = new MemoryStream(); + + //Save the converted PDF document to MemoryStream. + pdfDocument.Save(pdfStream); + pdfStream.Position = 0; + return Convert.ToBase64String(pdfStream.ToArray()); + } + } + private void SubstituteFont(object sender, SubstituteFontEventArgs args) + { + string filePath = string.Empty; + FileStream fileStream = null; + + if (args.OriginalFontName == "Calibri") + { + filePath = Path.GetFullPath(@"Data/calibri.ttf"); + fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read); + args.AlternateFontStream = fileStream; + } + else if (args.OriginalFontName == "Arial") + { + filePath = Path.GetFullPath(@"Data/arial.ttf"); + fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read); + args.AlternateFontStream = fileStream; + } + else + { + filePath = Path.GetFullPath(@"Data/times.ttf"); + fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read); + args.AlternateFontStream = fileStream; + } + } + } +} + diff --git a/Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/Properties/launchSettings.json b/Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/Properties/launchSettings.json new file mode 100644 index 00000000..a82d4042 --- /dev/null +++ b/Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/Properties/launchSettings.json @@ -0,0 +1,10 @@ +{ + "profiles": { + "Mock Lambda Test Tool": { + "commandName": "Executable", + "commandLineArgs": "--port 5050", + "workingDirectory": ".\\bin\\$(Configuration)\\net6.0", + "executablePath": "%USERPROFILE%\\.dotnet\\tools\\dotnet-lambda-test-tool-6.0.exe" + } + } +} \ No newline at end of file diff --git a/Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/Readme.md b/Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/Readme.md new file mode 100644 index 00000000..e817928d --- /dev/null +++ b/Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/Readme.md @@ -0,0 +1,49 @@ +# AWS Lambda Empty Function Project + +This starter project consists of: +* Function.cs - class file containing a class with a single function handler method +* aws-lambda-tools-defaults.json - default argument settings for use with Visual Studio and command line deployment tools for AWS + +You may also have a test project depending on the options selected. + +The generated function handler is a simple method accepting a string argument that returns the uppercase equivalent of the input string. Replace the body of this method, and parameters, to suit your needs. + +## Here are some steps to follow from Visual Studio: + +To deploy your function to AWS Lambda, right click the project in Solution Explorer and select *Publish to AWS Lambda*. + +To view your deployed function open its Function View window by double-clicking the function name shown beneath the AWS Lambda node in the AWS Explorer tree. + +To perform testing against your deployed function use the Test Invoke tab in the opened Function View window. + +To configure event sources for your deployed function, for example to have your function invoked when an object is created in an Amazon S3 bucket, use the Event Sources tab in the opened Function View window. + +To update the runtime configuration of your deployed function use the Configuration tab in the opened Function View window. + +To view execution logs of invocations of your function use the Logs tab in the opened Function View window. + +## Here are some steps to follow to get started from the command line: + +Once you have edited your template and code you can deploy your application using the [Amazon.Lambda.Tools Global Tool](https://github.com/aws/aws-extensions-for-dotnet-cli#aws-lambda-amazonlambdatools) from the command line. + +Install Amazon.Lambda.Tools Global Tools if not already installed. +``` + dotnet tool install -g Amazon.Lambda.Tools +``` + +If already installed check if new version is available. +``` + dotnet tool update -g Amazon.Lambda.Tools +``` + +Execute unit tests +``` + cd "Convert-Excel-to-PDF/test/Convert-Excel-to-PDF.Tests" + dotnet test +``` + +Deploy function to AWS Lambda +``` + cd "Convert-Excel-to-PDF/src/Convert-Excel-to-PDF" + dotnet lambda deploy-function +``` diff --git a/Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/aws-lambda-tools-defaults.json b/Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/aws-lambda-tools-defaults.json new file mode 100644 index 00000000..f5b4bed9 --- /dev/null +++ b/Getting Started/AWS/AWS Lambda/Convert Excel to PDF/Convert-Excel-to-PDF/aws-lambda-tools-defaults.json @@ -0,0 +1,16 @@ +{ + "Information": [ + "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.", + "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.", + "dotnet lambda help", + "All the command line options for the Lambda command can be specified in this file." + ], + "profile": "default", + "region": "us-east-1", + "configuration": "Release", + "function-architecture": "x86_64", + "function-runtime": "dotnet6", + "function-memory-size": 256, + "function-timeout": 30, + "function-handler": "Convert-Excel-to-PDF::Convert_Excel_to_PDF.Function::FunctionHandler" +} \ No newline at end of file diff --git a/Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF.sln b/Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF.sln new file mode 100644 index 00000000..f1019b84 --- /dev/null +++ b/Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34202.233 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Convert-Excel-to-PDF", "Convert-Excel-to-PDF\Convert-Excel-to-PDF.csproj", "{A03293DA-FDB4-457D-BF6E-BA8919F2DC3A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A03293DA-FDB4-457D-BF6E-BA8919F2DC3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A03293DA-FDB4-457D-BF6E-BA8919F2DC3A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A03293DA-FDB4-457D-BF6E-BA8919F2DC3A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A03293DA-FDB4-457D-BF6E-BA8919F2DC3A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {13B5C523-7292-46EC-A31A-F045224129B9} + EndGlobalSection +EndGlobal diff --git a/Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/App.config b/Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/App.config new file mode 100644 index 00000000..56efbc7b --- /dev/null +++ b/Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/Convert-Excel-to-PDF.csproj b/Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/Convert-Excel-to-PDF.csproj new file mode 100644 index 00000000..fadb1d5a --- /dev/null +++ b/Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/Convert-Excel-to-PDF.csproj @@ -0,0 +1,67 @@ + + + + + Debug + AnyCPU + {A03293DA-FDB4-457D-BF6E-BA8919F2DC3A} + Exe + Convert_Excel_to_PDF + Convert-Excel-to-PDF + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\AWSSDK.Core.3.7.204.8\lib\net45\AWSSDK.Core.dll + + + ..\packages\AWSSDK.Lambda.3.7.202.7\lib\net45\AWSSDK.Lambda.dll + + + ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/Program.cs b/Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/Program.cs new file mode 100644 index 00000000..f732b231 --- /dev/null +++ b/Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/Program.cs @@ -0,0 +1,51 @@ +using Amazon.Lambda.Model; +using Amazon.Lambda; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Amazon; + +namespace Convert_Excel_to_PDF +{ + internal class Program + { + static void Main(string[] args) + { + Console.WriteLine("Please enter your AWS Access Key ID :"); + string awsAccessKeyID = Console.ReadLine(); + Console.WriteLine("Please enter your AWS Secret Access Key :"); + string awsSecretAccessKey = Console.ReadLine(); + Console.WriteLine("Please enter your Function Name :"); + string functionName = Console.ReadLine(); + //Create a new AmazonLambdaClient + AmazonLambdaClient client = new AmazonLambdaClient(awsAccessKeyID, awsSecretAccessKey, RegionEndpoint.USEast1); + + //Create new InvokeRequest with published function name. + InvokeRequest invoke = new InvokeRequest + { + FunctionName = functionName, + InvocationType = InvocationType.RequestResponse, + Payload = "\"Test\"" + }; + //Get the InvokeResponse from client InvokeRequest. + InvokeResponse response = client.Invoke(invoke); + + //Read the response stream + var stream = new StreamReader(response.Payload); + JsonReader reader = new JsonTextReader(stream); + var serilizer = new JsonSerializer(); + var responseText = serilizer.Deserialize(reader); + //Convert Base64String into PDF document + byte[] bytes = Convert.FromBase64String(responseText.ToString()); + FileStream fileStream = new FileStream("Sample.xlsx", FileMode.Create); + BinaryWriter writer = new BinaryWriter(fileStream); + writer.Write(bytes, 0, bytes.Length); + writer.Close(); + System.Diagnostics.Process.Start("Sample.xlsx"); + } + } +} diff --git a/Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/Properties/AssemblyInfo.cs b/Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..61522add --- /dev/null +++ b/Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Convert-Excel-to-PDF")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Convert-Excel-to-PDF")] +[assembly: AssemblyCopyright("Copyright © 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a03293da-fdb4-457d-bf6e-ba8919f2dc3a")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/packages.config b/Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/packages.config new file mode 100644 index 00000000..7e1d608f --- /dev/null +++ b/Getting Started/AWS/Console Application/Convert Excel to PDF/Convert-Excel-to-PDF/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file