diff --git a/Create_NewPDF_From_Exsisting_document_pages/App.config b/Create_NewPDF_From_Exsisting_document_pages/App.config new file mode 100644 index 0000000..4b657bf --- /dev/null +++ b/Create_NewPDF_From_Exsisting_document_pages/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Create_NewPDF_From_Exsisting_document_pages/App.xaml b/Create_NewPDF_From_Exsisting_document_pages/App.xaml new file mode 100644 index 0000000..21c06d5 --- /dev/null +++ b/Create_NewPDF_From_Exsisting_document_pages/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/Create_NewPDF_From_Exsisting_document_pages/App.xaml.cs b/Create_NewPDF_From_Exsisting_document_pages/App.xaml.cs new file mode 100644 index 0000000..aa09e11 --- /dev/null +++ b/Create_NewPDF_From_Exsisting_document_pages/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 PDFViewer_WPF +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/Create_NewPDF_From_Exsisting_document_pages/Data/Input.pdf b/Create_NewPDF_From_Exsisting_document_pages/Data/Input.pdf new file mode 100644 index 0000000..14fa6b9 Binary files /dev/null and b/Create_NewPDF_From_Exsisting_document_pages/Data/Input.pdf differ diff --git a/Create_NewPDF_From_Exsisting_document_pages/MainWindow.xaml b/Create_NewPDF_From_Exsisting_document_pages/MainWindow.xaml new file mode 100644 index 0000000..bbfdb29 --- /dev/null +++ b/Create_NewPDF_From_Exsisting_document_pages/MainWindow.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/Create_NewPDF_From_Exsisting_document_pages/MainWindow.xaml.cs b/Create_NewPDF_From_Exsisting_document_pages/MainWindow.xaml.cs new file mode 100644 index 0000000..236313b --- /dev/null +++ b/Create_NewPDF_From_Exsisting_document_pages/MainWindow.xaml.cs @@ -0,0 +1,63 @@ +using Syncfusion.Pdf; +using Syncfusion.Pdf.Graphics; +using Syncfusion.Pdf.Parsing; +using Syncfusion.Pdf.Security; +using Syncfusion.Windows.PdfViewer; +using System; +using System.Drawing; +using System.IO; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; +using Bitmap = System.Drawing.Bitmap; +using Path = System.Windows.Shapes.Path; + +namespace WPF_Sample_FW +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + string filePath = "../../../Data/"; + public MainWindow() + { + InitializeComponent(); + + //Load a PDF document + PdfLoadedDocument ldoc = new PdfLoadedDocument(filePath + "Input.pdf"); + + ldoc.FlattenAnnotations(); + + if(ldoc.Form != null && ldoc.Form.Fields.Count > 0) + ldoc.Form.FlattenFields(); + + //Create a new instance of PdfDocument class + PdfDocument document = new PdfDocument(); + + //Set page margin value as 0 + document.PageSettings.Margins.All = 0; + + //Set page size as A3 + document.PageSettings.Size = PdfPageSize.A3; + + for (int i = 0; i < ldoc.Pages.Count; i++) + { + //Get loaded page as template + PdfTemplate template = ldoc.Pages[i].CreateTemplate(); + + //Create new page + PdfPage page = document.Pages.Add(); + + //Create Pdf graphics for the page + PdfGraphics g = page.Graphics; + + //Draw template with the size as page size + g.DrawPdfTemplate(template, new PointF(0, 0), new SizeF(page.GetClientSize().Width, page.GetClientSize().Height)); + + } + document.Save( filePath + "Output.pdf"); + PDFViewer.Load(filePath + "Output.pdf"); + } + } +} diff --git a/Create_NewPDF_From_Exsisting_document_pages/PDFViewer_WPF.csproj b/Create_NewPDF_From_Exsisting_document_pages/PDFViewer_WPF.csproj new file mode 100644 index 0000000..2a6a268 --- /dev/null +++ b/Create_NewPDF_From_Exsisting_document_pages/PDFViewer_WPF.csproj @@ -0,0 +1,12 @@ + + + + WinExe + + + + + + + + diff --git a/Create_NewPDF_From_Exsisting_document_pages/PDFViewer_WPF.sln b/Create_NewPDF_From_Exsisting_document_pages/PDFViewer_WPF.sln new file mode 100644 index 0000000..5f6dbcb --- /dev/null +++ b/Create_NewPDF_From_Exsisting_document_pages/PDFViewer_WPF.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36401.2 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDFViewer_WPF", "PDFViewer_WPF.csproj", "{0FAA7523-B034-4EA9-860A-A8936DFFD40E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0FAA7523-B034-4EA9-860A-A8936DFFD40E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0FAA7523-B034-4EA9-860A-A8936DFFD40E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0FAA7523-B034-4EA9-860A-A8936DFFD40E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0FAA7523-B034-4EA9-860A-A8936DFFD40E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BAAD6341-6945-42C7-8438-919E9DB8EB03} + EndGlobalSection +EndGlobal diff --git a/Create_NewPDF_From_Exsisting_document_pages/Properties/AssemblyInfo.cs b/Create_NewPDF_From_Exsisting_document_pages/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6a2c04c --- /dev/null +++ b/Create_NewPDF_From_Exsisting_document_pages/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("PDFViewer_WPF")] +//[assembly: AssemblyDescription("")] +//[assembly: AssemblyConfiguration("")] +//[assembly: AssemblyCompany("")] +//[assembly: AssemblyProduct("PDFViewer_WPF")] +//[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/Create_NewPDF_From_Exsisting_document_pages/Properties/Resources.Designer.cs b/Create_NewPDF_From_Exsisting_document_pages/Properties/Resources.Designer.cs new file mode 100644 index 0000000..75bb46f --- /dev/null +++ b/Create_NewPDF_From_Exsisting_document_pages/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 PDFViewer_WPF.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("PDFViewer_WPF.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/Create_NewPDF_From_Exsisting_document_pages/Properties/Resources.resx b/Create_NewPDF_From_Exsisting_document_pages/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Create_NewPDF_From_Exsisting_document_pages/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/Create_NewPDF_From_Exsisting_document_pages/Properties/Settings.Designer.cs b/Create_NewPDF_From_Exsisting_document_pages/Properties/Settings.Designer.cs new file mode 100644 index 0000000..67bc83e --- /dev/null +++ b/Create_NewPDF_From_Exsisting_document_pages/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 PDFViewer_WPF.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/Create_NewPDF_From_Exsisting_document_pages/Properties/Settings.settings b/Create_NewPDF_From_Exsisting_document_pages/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/Create_NewPDF_From_Exsisting_document_pages/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Create_NewPDF_From_Exsisting_document_pages/packages.config b/Create_NewPDF_From_Exsisting_document_pages/packages.config new file mode 100644 index 0000000..5b33600 --- /dev/null +++ b/Create_NewPDF_From_Exsisting_document_pages/packages.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Create_NewPDF_From_Exsisting_document_pages/targets/MultiTargeting.targets b/Create_NewPDF_From_Exsisting_document_pages/targets/MultiTargeting.targets new file mode 100644 index 0000000..4a85629 --- /dev/null +++ b/Create_NewPDF_From_Exsisting_document_pages/targets/MultiTargeting.targets @@ -0,0 +1,10 @@ + + + net462;net8.0-windows;net9.0-windows + true + False + True + True + True + + \ No newline at end of file