Skip to content

Commit e53d9e6

Browse files
committed
260184: Added code example for setting annotation intent.
1 parent b5c8d74 commit e53d9e6

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed
Lines changed: 25 additions & 0 deletions
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.36616.10 d17.14
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Setting-Annotation-Intent", "Setting-Annotation-Intent\Setting-Annotation-Intent.csproj", "{496FAA15-3DB2-40D7-8A99-5800A2457E19}"
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+
{496FAA15-3DB2-40D7-8A99-5800A2457E19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{496FAA15-3DB2-40D7-8A99-5800A2457E19}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{496FAA15-3DB2-40D7-8A99-5800A2457E19}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{496FAA15-3DB2-40D7-8A99-5800A2457E19}.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 = {6881FD4D-ED63-4653-BD6A-98DBA5EF6D52}
24+
EndGlobalSection
25+
EndGlobal

Annotation/Setting-Annotation-Intent/.NET/Setting-Annotation-Intent/Output/gitkeep.txt

Whitespace-only changes.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using Syncfusion.Drawing;
2+
using Syncfusion.Pdf;
3+
using Syncfusion.Pdf.Graphics;
4+
using Syncfusion.Pdf.Interactive;
5+
6+
// Create a new PDF document
7+
using (PdfDocument document = new PdfDocument())
8+
{
9+
// Add a page
10+
PdfPage page = document.Pages.Add();
11+
12+
// Define the bounds for the annotation
13+
RectangleF bounds = new RectangleF(100, 100, 200, 50);
14+
15+
// Create a FreeText annotation
16+
PdfFreeTextAnnotation freeText = new PdfFreeTextAnnotation(bounds);
17+
// Add content.
18+
freeText.Text = "Add Free Text Annotation with Intent";
19+
// Set the annotation intent to TypeWriter
20+
freeText.AnnotationIntent = PdfAnnotationIntent.FreeTextTypeWriter;
21+
22+
// Customize appearance
23+
freeText.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
24+
freeText.TextMarkupColor = Color.Black;
25+
freeText.BorderColor = Color.Gray;
26+
freeText.Color = Color.LightYellow;
27+
28+
// Add the annotation to the page
29+
page.Annotations.Add(freeText);
30+
31+
// Save the document
32+
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
33+
34+
// Close the document
35+
document.Close(true);
36+
}
Lines changed: 15 additions & 0 deletions
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>Setting_Annotation_Intent</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="31.2.3" />
13+
</ItemGroup>
14+
15+
</Project>

0 commit comments

Comments
 (0)