diff --git a/Annotation/Adding-transparency-for-annotations/.NET/Adding-transparency-for-annotations.sln b/Annotation/Adding-transparency-for-annotations/.NET/Adding-transparency-for-annotations.sln new file mode 100644 index 00000000..37ea5501 --- /dev/null +++ b/Annotation/Adding-transparency-for-annotations/.NET/Adding-transparency-for-annotations.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35707.178 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Adding-transparency-for-annotations", "Adding-transparency-for-annotations\Adding-transparency-for-annotations.csproj", "{96B579F5-516C-449D-8CFE-08D6517D15B1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {96B579F5-516C-449D-8CFE-08D6517D15B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {96B579F5-516C-449D-8CFE-08D6517D15B1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {96B579F5-516C-449D-8CFE-08D6517D15B1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {96B579F5-516C-449D-8CFE-08D6517D15B1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Annotation/Adding-transparency-for-annotations/.NET/Adding-transparency-for-annotations/Adding-transparency-for-annotations.csproj b/Annotation/Adding-transparency-for-annotations/.NET/Adding-transparency-for-annotations/Adding-transparency-for-annotations.csproj new file mode 100644 index 00000000..020f477c --- /dev/null +++ b/Annotation/Adding-transparency-for-annotations/.NET/Adding-transparency-for-annotations/Adding-transparency-for-annotations.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0 + Adding_transparency_for_annotations + enable + enable + + + + + + + diff --git a/Annotation/Adding-transparency-for-annotations/.NET/Adding-transparency-for-annotations/Output/gitkeep.txt b/Annotation/Adding-transparency-for-annotations/.NET/Adding-transparency-for-annotations/Output/gitkeep.txt new file mode 100644 index 00000000..e69de29b diff --git a/Annotation/Adding-transparency-for-annotations/.NET/Adding-transparency-for-annotations/Program.cs b/Annotation/Adding-transparency-for-annotations/.NET/Adding-transparency-for-annotations/Program.cs new file mode 100644 index 00000000..a6cf200d --- /dev/null +++ b/Annotation/Adding-transparency-for-annotations/.NET/Adding-transparency-for-annotations/Program.cs @@ -0,0 +1,33 @@ +using Syncfusion.Pdf.Graphics; +using Syncfusion.Pdf.Interactive; +using Syncfusion.Pdf; +using Syncfusion.Drawing; + +// Create a new PDF document. +PdfDocument document = new PdfDocument(); +//Add a new page. +PdfPage page = document.Pages.Add(); +//Create a new rectangle +RectangleF textAnnotationBounds = new RectangleF(10, 40, 100, 30); +//Create a new free text annotation. +PdfFreeTextAnnotation textAnnotation = new PdfFreeTextAnnotation(textAnnotationBounds); +//Set the text and font +textAnnotation.MarkupText = "Text Annotation"; +textAnnotation.Font = new PdfStandardFont(PdfFontFamily.Courier, 10); + +//Set transparency +textAnnotation.Opacity = 0.5F; + +//Set the line caption type. +textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout; +//Add this annotation to the PDF page. +page.Annotations.Add(textAnnotation); +//Create file stream. +using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) +{ + //Save the PDF document to file stream. + document.Save(outputFileStream); +} + +//Close the document +document.Close(true); \ No newline at end of file diff --git a/Pages/Insert-New-Page-in-Existing-PDF-with-Same-Size/.NET/Insert-New-Page-in-Existing-PDF-with-Same-Size.sln b/Pages/Insert-New-Page-in-Existing-PDF-with-Same-Size/.NET/Insert-New-Page-in-Existing-PDF-with-Same-Size.sln new file mode 100644 index 00000000..50096de1 --- /dev/null +++ b/Pages/Insert-New-Page-in-Existing-PDF-with-Same-Size/.NET/Insert-New-Page-in-Existing-PDF-with-Same-Size.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35707.178 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Insert-New-Page-in-Existing-PDF-with-Same-Size", "Insert-New-Page-in-Existing-PDF-with-Same-Size\Insert-New-Page-in-Existing-PDF-with-Same-Size.csproj", "{61AA9CD9-341F-4CA2-852A-888B5F6DFDAA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {61AA9CD9-341F-4CA2-852A-888B5F6DFDAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {61AA9CD9-341F-4CA2-852A-888B5F6DFDAA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {61AA9CD9-341F-4CA2-852A-888B5F6DFDAA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {61AA9CD9-341F-4CA2-852A-888B5F6DFDAA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Pages/Insert-New-Page-in-Existing-PDF-with-Same-Size/.NET/Insert-New-Page-in-Existing-PDF-with-Same-Size/Data/Input.pdf b/Pages/Insert-New-Page-in-Existing-PDF-with-Same-Size/.NET/Insert-New-Page-in-Existing-PDF-with-Same-Size/Data/Input.pdf new file mode 100644 index 00000000..da082542 Binary files /dev/null and b/Pages/Insert-New-Page-in-Existing-PDF-with-Same-Size/.NET/Insert-New-Page-in-Existing-PDF-with-Same-Size/Data/Input.pdf differ diff --git a/Pages/Insert-New-Page-in-Existing-PDF-with-Same-Size/.NET/Insert-New-Page-in-Existing-PDF-with-Same-Size/Insert-New-Page-in-Existing-PDF-with-Same-Size.csproj b/Pages/Insert-New-Page-in-Existing-PDF-with-Same-Size/.NET/Insert-New-Page-in-Existing-PDF-with-Same-Size/Insert-New-Page-in-Existing-PDF-with-Same-Size.csproj new file mode 100644 index 00000000..97c14df3 --- /dev/null +++ b/Pages/Insert-New-Page-in-Existing-PDF-with-Same-Size/.NET/Insert-New-Page-in-Existing-PDF-with-Same-Size/Insert-New-Page-in-Existing-PDF-with-Same-Size.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0 + Insert_New_Page_in_Existing_PDF_with_Same_Size + enable + enable + + + + + + + diff --git a/Pages/Insert-New-Page-in-Existing-PDF-with-Same-Size/.NET/Insert-New-Page-in-Existing-PDF-with-Same-Size/Output/gitkeep.txt b/Pages/Insert-New-Page-in-Existing-PDF-with-Same-Size/.NET/Insert-New-Page-in-Existing-PDF-with-Same-Size/Output/gitkeep.txt new file mode 100644 index 00000000..e69de29b diff --git a/Pages/Insert-New-Page-in-Existing-PDF-with-Same-Size/.NET/Insert-New-Page-in-Existing-PDF-with-Same-Size/Program.cs b/Pages/Insert-New-Page-in-Existing-PDF-with-Same-Size/.NET/Insert-New-Page-in-Existing-PDF-with-Same-Size/Program.cs new file mode 100644 index 00000000..7feac55b --- /dev/null +++ b/Pages/Insert-New-Page-in-Existing-PDF-with-Same-Size/.NET/Insert-New-Page-in-Existing-PDF-with-Same-Size/Program.cs @@ -0,0 +1,30 @@ +using Syncfusion.Pdf.Graphics; +using Syncfusion.Pdf.Parsing; +using Syncfusion.Pdf; +using Syncfusion.Drawing; +using System.Reflection.Metadata; + +// Load the PDF document from a FileStream +using (FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read)) +{ + PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream); + // Get the size of the first page + PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage; + + // Insert a new page at the beginning with the same size as the first page + PdfPageBase page = loadedDocument.Pages.Insert(0, loadedPage.Size); + + // Set the standard font + PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20); + // Draw the text on the page, centered + page.Graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new PointF(0, 0)); + + //Create file stream. + using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) + { + //Save the PDF document to file stream. + loadedDocument.Save(outputFileStream); + } + // Close the loaded document + loadedDocument.Close(true); +} \ No newline at end of file diff --git a/Text/Drawing-text-using-different-text-alignment/.NET/Drawing-text-using-different-text-alignment.sln b/Text/Drawing-text-using-different-text-alignment/.NET/Drawing-text-using-different-text-alignment.sln new file mode 100644 index 00000000..49d8ed9a --- /dev/null +++ b/Text/Drawing-text-using-different-text-alignment/.NET/Drawing-text-using-different-text-alignment.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35707.178 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Drawing-text-using-different-text-alignment", "Drawing-text-using-different-text-alignment\Drawing-text-using-different-text-alignment.csproj", "{5E186360-5164-4609-ABAE-D45018E28BDE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5E186360-5164-4609-ABAE-D45018E28BDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5E186360-5164-4609-ABAE-D45018E28BDE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5E186360-5164-4609-ABAE-D45018E28BDE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5E186360-5164-4609-ABAE-D45018E28BDE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Text/Drawing-text-using-different-text-alignment/.NET/Drawing-text-using-different-text-alignment/Drawing-text-using-different-text-alignment.csproj b/Text/Drawing-text-using-different-text-alignment/.NET/Drawing-text-using-different-text-alignment/Drawing-text-using-different-text-alignment.csproj new file mode 100644 index 00000000..965dc20c --- /dev/null +++ b/Text/Drawing-text-using-different-text-alignment/.NET/Drawing-text-using-different-text-alignment/Drawing-text-using-different-text-alignment.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0 + Drawing_text_using_different_text_alignment + enable + enable + + + + + + + diff --git a/Text/Drawing-text-using-different-text-alignment/.NET/Drawing-text-using-different-text-alignment/Output/gitkeep.txt b/Text/Drawing-text-using-different-text-alignment/.NET/Drawing-text-using-different-text-alignment/Output/gitkeep.txt new file mode 100644 index 00000000..e69de29b diff --git a/Text/Drawing-text-using-different-text-alignment/.NET/Drawing-text-using-different-text-alignment/Program.cs b/Text/Drawing-text-using-different-text-alignment/.NET/Drawing-text-using-different-text-alignment/Program.cs new file mode 100644 index 00000000..7e3972b1 --- /dev/null +++ b/Text/Drawing-text-using-different-text-alignment/.NET/Drawing-text-using-different-text-alignment/Program.cs @@ -0,0 +1,34 @@ + +using Syncfusion.Pdf.Graphics; +using Syncfusion.Pdf; +using Syncfusion.Drawing; + +//Create a new PDF document +PdfDocument document = new PdfDocument(); +//Add a page to the document +PdfPage page = document.Pages.Add(); +//Create PDF graphics for the page +PdfGraphics graphics = page.Graphics; +//Create new instance for string format +PdfStringFormat format = new PdfStringFormat(); + +//Set horizontal text alignment +format.Alignment = PdfTextAlignment.Right; +format.WordSpacing = 2f; +format.CharacterSpacing = 1f; + +//Set the standard font +PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12); +//Draw the rectangle +graphics.DrawRectangle(PdfPens.Black, new RectangleF(10, 10, 200, 20)); +//Draw the text +graphics.DrawString("Right-Alignment", font, PdfBrushes.Red, new RectangleF(10, 10, 200, 20), format); + +//Create file stream. +using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) +{ + //Save the PDF document to file stream. + document.Save(outputFileStream); +} +//Close the document +document.Close(true); \ No newline at end of file