Skip to content

Commit

Permalink
927950 Added features sample code
Browse files Browse the repository at this point in the history
  • Loading branch information
sameerkhan001 committed Dec 14, 2024
1 parent c0e933a commit e1c959d
Show file tree
Hide file tree
Showing 15 changed files with 199 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

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}") = "Exporting-Newly-Added-Annotations-FDF-File", "Exporting-Newly-Added-Annotations-FDF-File\Exporting-Newly-Added-Annotations-FDF-File.csproj", "{3896C029-44A0-4B6F-BCB5-B6AC57A6305E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3896C029-44A0-4B6F-BCB5-B6AC57A6305E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3896C029-44A0-4B6F-BCB5-B6AC57A6305E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3896C029-44A0-4B6F-BCB5-B6AC57A6305E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3896C029-44A0-4B6F-BCB5-B6AC57A6305E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Exporting_Newly_Added_Annotations_FDF_File</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="*" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

using Syncfusion.Drawing;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Interactive;
using Syncfusion.Pdf.Parsing;

//Load the PDF document from a file stream
using (FileStream docStream = new FileStream(Path.GetFullPath(@"Data\Input.pdf"), FileMode.Open, FileAccess.Read))
using (PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument(docStream))
{
//Create a PDF free text annotation
PdfFreeTextAnnotation freeText = new PdfFreeTextAnnotation(new RectangleF(10, 0, 50, 50));

//Set properties for the annotation
freeText.MarkupText = "Free Text with Callout"; //Text displayed as markup
freeText.TextMarkupColor = new PdfColor(Color.Black); //Set the text markup color
freeText.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 7f); //Set font and size
freeText.Color = new PdfColor(Color.Yellow); //Set background color
freeText.BorderColor = new PdfColor(Color.Red); //Set border color
freeText.Border = new PdfAnnotationBorder(0.5f); //Set border thickness

//Add the annotation to the first page of the PDF
pdfLoadedDocument.Pages[0].Annotations.Add(freeText);

//Export annotations to the FDF format and save to a file using a file stream
using (FileStream fdfFileStream = new FileStream(Path.GetFullPath(@"Output\Output.fdf"), FileMode.Create, FileAccess.Write))
{
pdfLoadedDocument.ExportAnnotations(fdfFileStream, AnnotationDataFormat.Fdf);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

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}") = "Exporting-Newly-Added-Annotations-JSON-File", "Exporting-Newly-Added-Annotations-JSON-File\Exporting-Newly-Added-Annotations-JSON-File.csproj", "{7E08A7B9-AAFF-4646-87FA-F5CCF3B3C69B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7E08A7B9-AAFF-4646-87FA-F5CCF3B3C69B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E08A7B9-AAFF-4646-87FA-F5CCF3B3C69B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E08A7B9-AAFF-4646-87FA-F5CCF3B3C69B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E08A7B9-AAFF-4646-87FA-F5CCF3B3C69B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Exporting_Newly_Added_Annotations_JSON_File</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="*" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Syncfusion.Drawing;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Interactive;
using Syncfusion.Pdf.Parsing;

//Load the PDF document from a file stream
using (FileStream docStream = new FileStream(Path.GetFullPath(@"Data\Input.pdf"), FileMode.Open, FileAccess.Read))
using (PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument(docStream))
{
//Create a PDF free text annotation
PdfFreeTextAnnotation freeText = new PdfFreeTextAnnotation(new RectangleF(10, 0, 50, 50));

//Set properties for the annotation
freeText.MarkupText = "Free Text with Callout"; //Text displayed as markup
freeText.TextMarkupColor = new PdfColor(Color.Black); //Set the text markup color
freeText.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 7f); //Set font and size
freeText.Color = new PdfColor(Color.Yellow); //Set background color
freeText.BorderColor = new PdfColor(Color.Red); //Set border color
freeText.Border = new PdfAnnotationBorder(0.5f); //Set border thickness

//Add the annotation to the first page of the PDF
pdfLoadedDocument.Pages[0].Annotations.Add(freeText);

//Export annotations to the JSON format and save to a file using a file stream
using (FileStream jsonFileStream = new FileStream(Path.GetFullPath(@"Output\Output.json"), FileMode.Create, FileAccess.Write))
{
pdfLoadedDocument.ExportAnnotations(jsonFileStream, AnnotationDataFormat.Json);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

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}") = "Exporting-Newly-Added-Annotations-XFDF-File", "Exporting-Newly-Added-Annotations-XFDF-File\Exporting-Newly-Added-Annotations-XFDF-File.csproj", "{5351DD92-0CDF-4645-B3D9-0FB14EEF738C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5351DD92-0CDF-4645-B3D9-0FB14EEF738C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5351DD92-0CDF-4645-B3D9-0FB14EEF738C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5351DD92-0CDF-4645-B3D9-0FB14EEF738C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5351DD92-0CDF-4645-B3D9-0FB14EEF738C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Exporting_Newly_Added_Annotations_XFDF_File</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="*" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Syncfusion.Drawing;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Interactive;
using Syncfusion.Pdf.Parsing;

//Load the PDF document from a file stream
using (FileStream docStream = new FileStream(Path.GetFullPath(@"Data\Input.pdf"), FileMode.Open, FileAccess.Read))
using (PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument(docStream))
{
//Create a PDF free text annotation
PdfFreeTextAnnotation freeText = new PdfFreeTextAnnotation(new RectangleF(10, 0, 50, 50));

//Set properties for the annotation
freeText.MarkupText = "Free Text with Callout"; //Text displayed as markup
freeText.TextMarkupColor = new PdfColor(Color.Black); //Set the text markup color
freeText.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 7f); //Set font and size
freeText.Color = new PdfColor(Color.Yellow); //Set background color
freeText.BorderColor = new PdfColor(Color.Red); //Set border color
freeText.Border = new PdfAnnotationBorder(0.5f); //Set border thickness

//Add the annotation to the first page of the PDF
pdfLoadedDocument.Pages[0].Annotations.Add(freeText);

//Export annotations to the XFDF format and save to a file using a file stream
using (FileStream xfdfFileStream = new FileStream(Path.GetFullPath(@"Output\Output.xfdf"), FileMode.Create, FileAccess.Write))
{
pdfLoadedDocument.ExportAnnotations(xfdfFileStream, AnnotationDataFormat.XFdf);
}
}

0 comments on commit e1c959d

Please sign in to comment.