diff --git a/PDF-to-image/PdfToImageConverter_DPI/App.config b/PDF-to-image/PdfToImageConverter_DPI/App.config new file mode 100644 index 0000000..2e533c2 --- /dev/null +++ b/PDF-to-image/PdfToImageConverter_DPI/App.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PDF-to-image/PdfToImageConverter_DPI/App.xaml b/PDF-to-image/PdfToImageConverter_DPI/App.xaml new file mode 100644 index 0000000..2cfb7c2 --- /dev/null +++ b/PDF-to-image/PdfToImageConverter_DPI/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/PDF-to-image/PdfToImageConverter_DPI/App.xaml.cs b/PDF-to-image/PdfToImageConverter_DPI/App.xaml.cs new file mode 100644 index 0000000..c1aff0c --- /dev/null +++ b/PDF-to-image/PdfToImageConverter_DPI/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace PdfToImageConverter_DPI +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/PDF-to-image/PdfToImageConverter_DPI/Input.pdf b/PDF-to-image/PdfToImageConverter_DPI/Input.pdf new file mode 100644 index 0000000..468642e Binary files /dev/null and b/PDF-to-image/PdfToImageConverter_DPI/Input.pdf differ diff --git a/PDF-to-image/PdfToImageConverter_DPI/MainWindow.xaml b/PDF-to-image/PdfToImageConverter_DPI/MainWindow.xaml new file mode 100644 index 0000000..d68c778 --- /dev/null +++ b/PDF-to-image/PdfToImageConverter_DPI/MainWindow.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/PDF-to-image/PdfToImageConverter_DPI/MainWindow.xaml.cs b/PDF-to-image/PdfToImageConverter_DPI/MainWindow.xaml.cs new file mode 100644 index 0000000..c1ef339 --- /dev/null +++ b/PDF-to-image/PdfToImageConverter_DPI/MainWindow.xaml.cs @@ -0,0 +1,54 @@ +using Syncfusion.PdfToImageConverter; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using System.Drawing; +using System.Drawing.Imaging; + +namespace PdfToImageConverter_DPI +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + PdfToImageConverter imageConverter = new PdfToImageConverter(); + + FileStream inputStream = new FileStream("../../Input.pdf", FileMode.Open, FileAccess.ReadWrite); + imageConverter.Load(inputStream); + + // Convert PDF page to image stream with desired DPI + Stream outputStream = imageConverter.Convert(0, false, false); + // Load the image + Bitmap originalImage = new Bitmap(outputStream); + + //// Set DPI + originalImage.SetResolution(451, 451); + + ////// Get TIFF codec + ImageCodecInfo tiffCodec = ImageCodecInfo.GetImageEncoders().First(codec => codec.FormatID == ImageFormat.Tiff.Guid); + + // Set CCITT Group 4 compression + EncoderParameters encoderParams = new EncoderParameters(1); + encoderParams.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Compression, (long)EncoderValue.CompressionCCITT4); + + // Save as 1-bit TIFF with CCITT G4 + originalImage.Save("sample.tif"); + } + } +} diff --git a/PDF-to-image/PdfToImageConverter_DPI/PdfToImageConverter_DPI.csproj b/PDF-to-image/PdfToImageConverter_DPI/PdfToImageConverter_DPI.csproj new file mode 100644 index 0000000..458c913 --- /dev/null +++ b/PDF-to-image/PdfToImageConverter_DPI/PdfToImageConverter_DPI.csproj @@ -0,0 +1,117 @@ + + + + + Debug + AnyCPU + {7C953B3D-F21C-45D3-8DA6-FB2FF1476BFA} + WinExe + PdfToImageConverter_DPI + PdfToImageConverter_DPI + v4.6.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + packages\Syncfusion.Licensing.32.1.19\lib\net462\Syncfusion.Licensing.dll + + + packages\Syncfusion.PdfToImageConverter.WPF.32.1.19\lib\net462\Syncfusion.PdfToImageConverter.Base.dll + + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/PDF-to-image/PdfToImageConverter_DPI/PdfToImageConverter_DPI.slnx b/PDF-to-image/PdfToImageConverter_DPI/PdfToImageConverter_DPI.slnx new file mode 100644 index 0000000..ef8f628 --- /dev/null +++ b/PDF-to-image/PdfToImageConverter_DPI/PdfToImageConverter_DPI.slnx @@ -0,0 +1,3 @@ + + + diff --git a/PDF-to-image/PdfToImageConverter_DPI/Properties/AssemblyInfo.cs b/PDF-to-image/PdfToImageConverter_DPI/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..76db44f --- /dev/null +++ b/PDF-to-image/PdfToImageConverter_DPI/Properties/AssemblyInfo.cs @@ -0,0 +1,52 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// 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("PdfToImageConverter_DPI")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("PdfToImageConverter_DPI")] +[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)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// 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/PDF-to-image/PdfToImageConverter_DPI/Properties/Resources.Designer.cs b/PDF-to-image/PdfToImageConverter_DPI/Properties/Resources.Designer.cs new file mode 100644 index 0000000..39e8d8a --- /dev/null +++ b/PDF-to-image/PdfToImageConverter_DPI/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace PdfToImageConverter_DPI.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PdfToImageConverter_DPI.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/PDF-to-image/PdfToImageConverter_DPI/Properties/Resources.resx b/PDF-to-image/PdfToImageConverter_DPI/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/PDF-to-image/PdfToImageConverter_DPI/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/PDF-to-image/PdfToImageConverter_DPI/Properties/Settings.Designer.cs b/PDF-to-image/PdfToImageConverter_DPI/Properties/Settings.Designer.cs new file mode 100644 index 0000000..239d0a3 --- /dev/null +++ b/PDF-to-image/PdfToImageConverter_DPI/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace PdfToImageConverter_DPI.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/PDF-to-image/PdfToImageConverter_DPI/Properties/Settings.settings b/PDF-to-image/PdfToImageConverter_DPI/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/PDF-to-image/PdfToImageConverter_DPI/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/PDF-to-image/PdfToImageConverter_DPI/packages.config b/PDF-to-image/PdfToImageConverter_DPI/packages.config new file mode 100644 index 0000000..19ac800 --- /dev/null +++ b/PDF-to-image/PdfToImageConverter_DPI/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file