diff --git a/Annotation/Getting-annotation-creation-date-from-existing-pdf/.NET/Getting-annotation-creation-date-from-existing-pdf.sln b/Annotation/Get-annotation-creation-date-from-PDF/.NET/Get-annotation-creation-date-from-pdf.sln similarity index 76% rename from Annotation/Getting-annotation-creation-date-from-existing-pdf/.NET/Getting-annotation-creation-date-from-existing-pdf.sln rename to Annotation/Get-annotation-creation-date-from-PDF/.NET/Get-annotation-creation-date-from-pdf.sln index 58bf25fd..6f2dd042 100644 --- a/Annotation/Getting-annotation-creation-date-from-existing-pdf/.NET/Getting-annotation-creation-date-from-existing-pdf.sln +++ b/Annotation/Get-annotation-creation-date-from-PDF/.NET/Get-annotation-creation-date-from-pdf.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.12.35527.113 d17.12 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Getting-annotation-creation-date-from-existing-pdf", "Getting-annotation-creation-date-from-existing-pdf\Getting-annotation-creation-date-from-existing-pdf.csproj", "{99C4DAFC-5512-4A2B-AAE0-9CF0464BBD1C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Get-annotation-creation-date-from-pdf", "Get-annotation-creation-date-from-pdf\Get-annotation-creation-date-from-pdf.csproj", "{99C4DAFC-5512-4A2B-AAE0-9CF0464BBD1C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Annotation/Getting-annotation-creation-date-from-existing-pdf/.NET/Getting-annotation-creation-date-from-existing-pdf/Data/Input.pdf b/Annotation/Get-annotation-creation-date-from-PDF/.NET/Get-annotation-creation-date-from-pdf/Data/Input.pdf similarity index 94% rename from Annotation/Getting-annotation-creation-date-from-existing-pdf/.NET/Getting-annotation-creation-date-from-existing-pdf/Data/Input.pdf rename to Annotation/Get-annotation-creation-date-from-PDF/.NET/Get-annotation-creation-date-from-pdf/Data/Input.pdf index d98d79ad..2ab406b8 100644 Binary files a/Annotation/Getting-annotation-creation-date-from-existing-pdf/.NET/Getting-annotation-creation-date-from-existing-pdf/Data/Input.pdf and b/Annotation/Get-annotation-creation-date-from-PDF/.NET/Get-annotation-creation-date-from-pdf/Data/Input.pdf differ diff --git a/Annotation/Getting-annotation-creation-date-from-existing-pdf/.NET/Getting-annotation-creation-date-from-existing-pdf/Getting-annotation-creation-date-from-existing-pdf.csproj b/Annotation/Get-annotation-creation-date-from-PDF/.NET/Get-annotation-creation-date-from-pdf/Get-annotation-creation-date-from-pdf.csproj similarity index 61% rename from Annotation/Getting-annotation-creation-date-from-existing-pdf/.NET/Getting-annotation-creation-date-from-existing-pdf/Getting-annotation-creation-date-from-existing-pdf.csproj rename to Annotation/Get-annotation-creation-date-from-PDF/.NET/Get-annotation-creation-date-from-pdf/Get-annotation-creation-date-from-pdf.csproj index a0a3748e..fdb9e25b 100644 --- a/Annotation/Getting-annotation-creation-date-from-existing-pdf/.NET/Getting-annotation-creation-date-from-existing-pdf/Getting-annotation-creation-date-from-existing-pdf.csproj +++ b/Annotation/Get-annotation-creation-date-from-PDF/.NET/Get-annotation-creation-date-from-pdf/Get-annotation-creation-date-from-pdf.csproj @@ -3,7 +3,7 @@ Exe net8.0 - Getting_annotation_creation_date_from_existing_pdf + Get-annotation-creation-date-from-pdf enable enable @@ -12,4 +12,10 @@ + + + PreserveNewest + + + diff --git a/Annotation/Get-annotation-creation-date-from-PDF/.NET/Get-annotation-creation-date-from-pdf/Program.cs b/Annotation/Get-annotation-creation-date-from-PDF/.NET/Get-annotation-creation-date-from-pdf/Program.cs new file mode 100644 index 00000000..62a789f1 --- /dev/null +++ b/Annotation/Get-annotation-creation-date-from-PDF/.NET/Get-annotation-creation-date-from-pdf/Program.cs @@ -0,0 +1,22 @@ +using Syncfusion.Pdf.Interactive; +using Syncfusion.Pdf.Parsing; +using Syncfusion.Pdf; + +// Load the PDF document +using (FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read)) +{ + using (PdfLoadedDocument document = new PdfLoadedDocument(inputStream)) + { + + //Get the first page from the document + PdfLoadedPage firstPage = document.Pages[0] as PdfLoadedPage; + + //Get the annotation on that page + PdfLoadedAnnotation annotation = firstPage.Annotations[1] as PdfLoadedAnnotation; + + //Get the annotation creation date. + DateTime creationDate = annotation.CreationDate; + + Console.WriteLine("Annotation Creation Date: " + creationDate); + } +} diff --git a/Annotation/Getting-annotation-type-from-existing-PDF/.NET/Getting-annotation-type-from-existing-PDF.sln b/Annotation/Get-annotation-type-from-pdf/.NET/Get-annotation-type-from-pdf.sln similarity index 78% rename from Annotation/Getting-annotation-type-from-existing-PDF/.NET/Getting-annotation-type-from-existing-PDF.sln rename to Annotation/Get-annotation-type-from-pdf/.NET/Get-annotation-type-from-pdf.sln index 5753f77e..f6a5aa9f 100644 --- a/Annotation/Getting-annotation-type-from-existing-PDF/.NET/Getting-annotation-type-from-existing-PDF.sln +++ b/Annotation/Get-annotation-type-from-pdf/.NET/Get-annotation-type-from-pdf.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.12.35527.113 d17.12 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Getting-annotation-type-from-existing-PDF", "Getting-annotation-type-from-existing-PDF\Getting-annotation-type-from-existing-PDF.csproj", "{8985CAE2-2683-4690-BFA7-3A2A16065CBD}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Get-annotation-type-from-pdf", "Get-annotation-type-from-pdf\Get-annotation-type-from-pdf.csproj", "{8985CAE2-2683-4690-BFA7-3A2A16065CBD}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Annotation/Getting-annotation-type-from-existing-PDF/.NET/Getting-annotation-type-from-existing-PDF/Data/Input.pdf b/Annotation/Get-annotation-type-from-pdf/.NET/Get-annotation-type-from-pdf/Data/Input.pdf similarity index 100% rename from Annotation/Getting-annotation-type-from-existing-PDF/.NET/Getting-annotation-type-from-existing-PDF/Data/Input.pdf rename to Annotation/Get-annotation-type-from-pdf/.NET/Get-annotation-type-from-pdf/Data/Input.pdf diff --git a/Annotation/Getting-annotation-type-from-existing-PDF/.NET/Getting-annotation-type-from-existing-PDF/Getting-annotation-type-from-existing-PDF.csproj b/Annotation/Get-annotation-type-from-pdf/.NET/Get-annotation-type-from-pdf/Get-annotation-type-from-pdf.csproj similarity index 62% rename from Annotation/Getting-annotation-type-from-existing-PDF/.NET/Getting-annotation-type-from-existing-PDF/Getting-annotation-type-from-existing-PDF.csproj rename to Annotation/Get-annotation-type-from-pdf/.NET/Get-annotation-type-from-pdf/Get-annotation-type-from-pdf.csproj index 1043569a..39c536f9 100644 --- a/Annotation/Getting-annotation-type-from-existing-PDF/.NET/Getting-annotation-type-from-existing-PDF/Getting-annotation-type-from-existing-PDF.csproj +++ b/Annotation/Get-annotation-type-from-pdf/.NET/Get-annotation-type-from-pdf/Get-annotation-type-from-pdf.csproj @@ -3,7 +3,7 @@ Exe net8.0 - Getting_annotation_type_from_existing_PDF + Get-annotation-type-from-pdf enable enable @@ -12,4 +12,10 @@ + + + PreserveNewest + + + diff --git a/Annotation/Get-annotation-type-from-pdf/.NET/Get-annotation-type-from-pdf/Program.cs b/Annotation/Get-annotation-type-from-pdf/.NET/Get-annotation-type-from-pdf/Program.cs new file mode 100644 index 00000000..7ccb4106 --- /dev/null +++ b/Annotation/Get-annotation-type-from-pdf/.NET/Get-annotation-type-from-pdf/Program.cs @@ -0,0 +1,23 @@ +using Syncfusion.Pdf.Interactive; +using Syncfusion.Pdf.Parsing; +using Syncfusion.Pdf; + +// Load the PDF document using a file stream +using (FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read)) +{ + using (PdfLoadedDocument document = new PdfLoadedDocument(inputStream)) + { + //Get the pages of the PDF file + for (int i = 0; i < document.PageCount; i++) + { + Console.WriteLine("Page Number: " + i); + PdfLoadedPage page = document.Pages[i] as PdfLoadedPage; + + //Get the annotation type. + foreach (PdfLoadedAnnotation annotation in page.Annotations) + { + Console.WriteLine("Annotation Type: " + annotation.Type.ToString()); + } + } + } +} \ No newline at end of file diff --git a/Annotation/Getting-annotation-creation-date-from-existing-pdf/.NET/Getting-annotation-creation-date-from-existing-pdf/Program.cs b/Annotation/Getting-annotation-creation-date-from-existing-pdf/.NET/Getting-annotation-creation-date-from-existing-pdf/Program.cs deleted file mode 100644 index 8f748fe7..00000000 --- a/Annotation/Getting-annotation-creation-date-from-existing-pdf/.NET/Getting-annotation-creation-date-from-existing-pdf/Program.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Syncfusion.Pdf.Interactive; -using Syncfusion.Pdf.Parsing; -using Syncfusion.Pdf; - -// Load the PDF document -FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read); -PdfLoadedDocument document = new PdfLoadedDocument(inputStream); -// Load the collection of pages in the PDF document -PdfLoadedPageCollection loadedPages = document.Pages; - -// Iterate through all the pages in the document -for (int i = 0; i < loadedPages.Count; i++) -{ - // Access the current page - PdfLoadedPage loadedPage = loadedPages[i] as PdfLoadedPage; - // Access the annotation collection on the current page - PdfLoadedAnnotationCollection annotations = loadedPage.Annotations; - // Get the total number of annotations on the current page - int numAnnotations = annotations.Count; - // Iterate through all annotations on the current page - for (int j = 0; j < numAnnotations; j++) - { - // Iterate through rectangle annotations - if (annotations[j].GetType().ToString() == "Syncfusion.Pdf.Interactive.PdfLoadedRectangleAnnotation") - { - // Handle rectangle annotation - PdfLoadedRectangleAnnotation rectangleAnnot = annotations[j] as PdfLoadedRectangleAnnotation; - DateTime creationDate = rectangleAnnot.CreationDate; - Console.WriteLine(creationDate); - } - } -} -//Close the document -document.Close(true); -inputStream.Dispose(); diff --git a/Annotation/Getting-annotation-type-from-existing-PDF/.NET/Getting-annotation-type-from-existing-PDF/Program.cs b/Annotation/Getting-annotation-type-from-existing-PDF/.NET/Getting-annotation-type-from-existing-PDF/Program.cs deleted file mode 100644 index b93edc95..00000000 --- a/Annotation/Getting-annotation-type-from-existing-PDF/.NET/Getting-annotation-type-from-existing-PDF/Program.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Syncfusion.Pdf.Interactive; -using Syncfusion.Pdf.Parsing; -using Syncfusion.Pdf; - -// Load the PDF document using a file stream -FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read); -PdfLoadedDocument document = new PdfLoadedDocument(inputStream); - -// Load the page collection from the PDF document -PdfLoadedPageCollection loadedPages = document.Pages; - -// Iterate through all pages in the document -for (int i = 0; i < loadedPages.Count; i++) -{ - // Access each page - PdfLoadedPage loadedPage = loadedPages[i] as PdfLoadedPage; - - // Check if the page contains annotations - if (loadedPage.Annotations.Count > 0) - { - // Iterate through each annotation on the page - foreach (PdfLoadedAnnotation annot in loadedPage.Annotations) - { - // Identify the type of the annotation - PdfLoadedAnnotationType annotationType; - - if (annot is PdfLoadedRectangleAnnotation) - { - annotationType = PdfLoadedAnnotationType.RectangleAnnotation; - } - else if (annot is PdfLoadedTextMarkupAnnotation) - { - annotationType = PdfLoadedAnnotationType.TextMarkupAnnotation; - } - else if (annot is PdfLoadedTextWebLinkAnnotation) - { - annotationType = PdfLoadedAnnotationType.TextWebLinkAnnotation; - } - else if (annot is PdfLoadedPopupAnnotation) - { - annotationType = PdfLoadedAnnotationType.PopupAnnotation; - } - else - { - annotationType = PdfLoadedAnnotationType.Null; - } - - // Print the annotation type to the console - Console.WriteLine(annotationType); - } - } -} - -// Close the document and release resources -document.Close(true); -inputStream.Dispose(); -Console.ReadKey(); \ No newline at end of file