Skip to content

Commit 66dc330

Browse files
committed
980802: Added sample project in Quad point
1 parent bea5d43 commit 66dc330

5 files changed

Lines changed: 84 additions & 0 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.14.36408.4 d17.14
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Adding-quad-points-to-existing-redaction-annotations", "Adding-quad-points-to-existing-redaction-annotations\Adding-quad-points-to-existing-redaction-annotations.csproj", "{7EAC121E-76EB-4D12-AF60-D457BE069660}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{7EAC121E-76EB-4D12-AF60-D457BE069660}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{7EAC121E-76EB-4D12-AF60-D457BE069660}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{7EAC121E-76EB-4D12-AF60-D457BE069660}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{7EAC121E-76EB-4D12-AF60-D457BE069660}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {AC2186CF-C132-4B74-9E9B-995A2480B219}
24+
EndGlobalSection
25+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Adding_quad_points_to_existing_redaction_annotations</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="*" />
13+
</ItemGroup>
14+
15+
</Project>

Annotation/Adding-quad-points-to-existing-redaction-annotations/.NET/Adding-quad-points-to-existing-redaction-annotations/Output/.gitkeep

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using Syncfusion.Drawing;
2+
using Syncfusion.Pdf.Graphics;
3+
using Syncfusion.Pdf.Interactive;
4+
using Syncfusion.Pdf.Parsing;
5+
6+
// Load the existing PDF document using FileStream
7+
using (FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read))
8+
{
9+
// Load the PDF document from the input stream
10+
using (PdfLoadedDocument ldoc = new PdfLoadedDocument(inputStream))
11+
{
12+
//Load the existing PdfLoadedRedactionAnnotation
13+
PdfLoadedRedactionAnnotation annot = ldoc.Pages[0].Annotations[0] as PdfLoadedRedactionAnnotation;
14+
15+
//set the bounds
16+
List<RectangleF> bounds = new List<RectangleF>();
17+
bounds.Add(new RectangleF(100, 100, 50, 20));
18+
bounds.Add(new RectangleF(200, 150, 60, 25));
19+
annot.BoundsCollection = bounds;
20+
21+
//set the inner color
22+
annot.InnerColor = Color.Black;
23+
//set the border color
24+
annot.BorderColor = Color.Green;
25+
//set the text color
26+
annot.TextColor = Color.Yellow;
27+
//set the font
28+
annot.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 10);
29+
//set overlay text
30+
annot.OverlayText = "Redact";
31+
//set text alignment
32+
annot.TextAlignment = PdfTextAlignment.Center;
33+
annot.RepeatText = true;
34+
35+
// Save the modified document using a new FileStream
36+
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.Write))
37+
{
38+
// Save changes to a new PDF file
39+
ldoc.Save(outputStream);
40+
}
41+
// Close the document and release resources
42+
ldoc.Close(true);
43+
}
44+
}

0 commit comments

Comments
 (0)