diff --git a/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF.sln b/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF.sln new file mode 100644 index 00000000..27449d2d --- /dev/null +++ b/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36408.4 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Convert-EMF-to-PDF", "Convert-EMF-to-PDF\Convert-EMF-to-PDF.csproj", "{31495091-2413-4172-8197-4D714A487C9B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {31495091-2413-4172-8197-4D714A487C9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {31495091-2413-4172-8197-4D714A487C9B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {31495091-2413-4172-8197-4D714A487C9B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {31495091-2413-4172-8197-4D714A487C9B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3007161A-3616-4ABD-91C7-A153F79A32CE} + EndGlobalSection +EndGlobal diff --git a/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF/App.config b/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF/App.config new file mode 100644 index 00000000..56efbc7b --- /dev/null +++ b/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF/Convert-EMF-to-PDF.csproj b/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF/Convert-EMF-to-PDF.csproj new file mode 100644 index 00000000..e203815c --- /dev/null +++ b/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF/Convert-EMF-to-PDF.csproj @@ -0,0 +1,64 @@ + + + + + Debug + AnyCPU + {31495091-2413-4172-8197-4D714A487C9B} + Exe + Convert_EMF_to_PDF + Convert-EMF-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\Syncfusion.Compression.Base.30.2.7\lib\net462\Syncfusion.Compression.Base.dll + + + ..\packages\Syncfusion.Licensing.30.2.7\lib\net462\Syncfusion.Licensing.dll + + + ..\packages\Syncfusion.Pdf.WinForms.30.2.7\lib\net462\Syncfusion.Pdf.Base.dll + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF/Data/Input.emf b/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF/Data/Input.emf new file mode 100644 index 00000000..2fa495b2 Binary files /dev/null and b/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF/Data/Input.emf differ diff --git a/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF/Program.cs b/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF/Program.cs new file mode 100644 index 00000000..99a3ee88 --- /dev/null +++ b/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF/Program.cs @@ -0,0 +1,50 @@ +using Syncfusion.Pdf; +using Syncfusion.Pdf.Graphics; +using System; +using System.Drawing; +using System.Drawing.Imaging; + +namespace Convert_EMF_to_PDF +{ + internal class Program + { + static void Main(string[] args) + { + // Create a new PDF document + PdfDocument doc = new PdfDocument(); + + // Set all page margins to zero + doc.PageSettings.Margins.All = 0; + + // Add a new page to the document + PdfPage page = doc.Pages.Add(); + + // Create PDF graphics object for drawing on the page + PdfGraphics graphics = page.Graphics; + + // Define layout format for rendering metafile content + PdfMetafileLayoutFormat format = new PdfMetafileLayoutFormat(); + + // Enable splitting of images across pages if needed + format.SplitImages = true; + + // Enable splitting of text lines across pages if needed + format.SplitTextLines = true; + + // Load the EMF (Enhanced Metafile) image from file + Metafile metaChart = new Metafile(@"../../Data/Input.emf"); + + // Convert the metafile to a PDF-compatible format + PdfMetafile pdfMetaChart = new PdfMetafile(metaChart); + + // Draw the metafile image on the entire page area + graphics.DrawImage(pdfMetaChart, new RectangleF(0, 0, page.GetClientSize().Width, page.GetClientSize().Height)); + + // Save the document to a file + doc.Save(@"Output.pdf"); + + // Close the document and release resources + doc.Close(true); + } + } +} diff --git a/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF/Properties/AssemblyInfo.cs b/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..8c4e9e1b --- /dev/null +++ b/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +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-EMF-to-PDF")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Convert-EMF-to-PDF")] +[assembly: AssemblyCopyright("Copyright © 2025")] +[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("31495091-2413-4172-8197-4d714a487c9b")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF/packages.config b/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF/packages.config new file mode 100644 index 00000000..1dbef920 --- /dev/null +++ b/Images/Convert-EMF-to-PDF/.NET Framework/Convert-EMF-to-PDF/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file