-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from SyncfusionExamples/927950
927950 Added new feature sample projects in Volume 4 main release
- Loading branch information
Showing
57 changed files
with
5,498 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
...dding-Document-Level JavaScript-Actions/.NET/Adding-Document-Level JavaScript-Actions.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}") = "Adding-Document-Level JavaScript-Actions", "Adding-Document-Level JavaScript-Actions\Adding-Document-Level JavaScript-Actions.csproj", "{E1DC0D2B-760C-4A34-A94A-5495C129F742}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{E1DC0D2B-760C-4A34-A94A-5495C129F742}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E1DC0D2B-760C-4A34-A94A-5495C129F742}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E1DC0D2B-760C-4A34-A94A-5495C129F742}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E1DC0D2B-760C-4A34-A94A-5495C129F742}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
15 changes: 15 additions & 0 deletions
15
.../Adding-Document-Level JavaScript-Actions/Adding-Document-Level JavaScript-Actions.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>Adding_Document_Level_JavaScript_Actions</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="*" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Empty file.
25 changes: 25 additions & 0 deletions
25
...ocument-Level JavaScript-Actions/.NET/Adding-Document-Level JavaScript-Actions/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Syncfusion.Pdf.Interactive; | ||
using Syncfusion.Pdf; | ||
|
||
// Create a new PDF document instance. | ||
PdfDocument document = new PdfDocument(); | ||
|
||
// Retrieve the JavaScript collection from the document. | ||
PdfDocumentJavaScriptCollection javaScriptCollection = document.DocumentJavaScripts; | ||
|
||
// Define a new JavaScript action that displays an alert with the message "Hello World!!!". | ||
PdfJavaScriptAction javaScriptAction = new PdfJavaScriptAction("app.alert(\"Hello World!!!\")"); | ||
|
||
// Set the name of the JavaScript action. | ||
javaScriptAction.Name = "Test"; | ||
|
||
// Add the JavaScript action to the document's JavaScript collection. | ||
javaScriptCollection.Add(javaScriptAction); | ||
|
||
// Save the PDF document using a file stream. | ||
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output\Output.pdf"), FileMode.Create, FileAccess.Write)) | ||
{ | ||
document.Save(fileStream); | ||
} | ||
// Close the document to release resources. | ||
document.Close(true); |
22 changes: 22 additions & 0 deletions
22
...emove-Document-Level-JavaScript-Actions/.NET/Remove-Document-Level-JavaScript-Actions.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}") = "Remove-Document-Level-JavaScript-Actions", "Remove-Document-Level-JavaScript-Actions\Remove-Document-Level-JavaScript-Actions.csproj", "{257A87D1-49E3-4105-95AC-9DD2795BC0FB}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{257A87D1-49E3-4105-95AC-9DD2795BC0FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{257A87D1-49E3-4105-95AC-9DD2795BC0FB}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{257A87D1-49E3-4105-95AC-9DD2795BC0FB}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{257A87D1-49E3-4105-95AC-9DD2795BC0FB}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Binary file added
BIN
+679 Bytes
...ent-Level-JavaScript-Actions/.NET/Remove-Document-Level-JavaScript-Actions/Data/Input.pdf
Binary file not shown.
Empty file.
24 changes: 24 additions & 0 deletions
24
...ocument-Level-JavaScript-Actions/.NET/Remove-Document-Level-JavaScript-Actions/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
| ||
using Syncfusion.Pdf.Interactive; | ||
using Syncfusion.Pdf.Parsing; | ||
using Syncfusion.Pdf; | ||
|
||
//Load an existing 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)) | ||
{ | ||
//Retrieve the JavaScript collection from the document | ||
PdfDocumentJavaScriptCollection javaScriptCollection = document.DocumentJavaScripts; | ||
|
||
//Access the first JavaScript action in the collection | ||
PdfJavaScriptAction javaScriptAction = javaScriptCollection[0]; | ||
|
||
//Remove the selected JavaScript action from the collection | ||
javaScriptCollection.Remove(javaScriptAction); | ||
|
||
//Save the modified document using a file stream | ||
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output\Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) | ||
{ | ||
document.Save(outputStream); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
.../Remove-Document-Level-JavaScript-Actions/Remove-Document-Level-JavaScript-Actions.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>Remove_Document_Level_JavaScript_Actions</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="*" /> | ||
</ItemGroup> | ||
|
||
</Project> |
22 changes: 22 additions & 0 deletions
22
...eve-Document-Level-JavaScript-Actions/.NET/Retrieve-Document-Level-JavaScript-Actions.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}") = "Retrieve-Document-Level-JavaScript-Actions", "Retrieve-Document-Level-JavaScript-Actions\Retrieve-Document-Level-JavaScript-Actions.csproj", "{6CA2DAC7-3E0E-4C06-ABBE-7185157F8123}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{6CA2DAC7-3E0E-4C06-ABBE-7185157F8123}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{6CA2DAC7-3E0E-4C06-ABBE-7185157F8123}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{6CA2DAC7-3E0E-4C06-ABBE-7185157F8123}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{6CA2DAC7-3E0E-4C06-ABBE-7185157F8123}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Binary file added
BIN
+679 Bytes
...t-Level-JavaScript-Actions/.NET/Retrieve-Document-Level-JavaScript-Actions/Data/Input.pdf
Binary file not shown.
21 changes: 21 additions & 0 deletions
21
...ument-Level-JavaScript-Actions/.NET/Retrieve-Document-Level-JavaScript-Actions/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using Syncfusion.Pdf; | ||
using Syncfusion.Pdf.Interactive; | ||
using Syncfusion.Pdf.Parsing; | ||
|
||
//Load an existing PDF document using a file stream | ||
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Data\Input.pdf"), FileMode.Open, FileAccess.Read)) | ||
using (PdfLoadedDocument document = new PdfLoadedDocument(fileStream)) | ||
{ | ||
//Retrieve the JavaScript collection from the loaded document | ||
PdfDocumentJavaScriptCollection javaScriptCollection = document.DocumentJavaScripts; | ||
|
||
//Iterate through the JavaScript actions in the collection | ||
foreach (PdfJavaScriptAction action in javaScriptCollection) | ||
{ | ||
//Display the name of the JavaScript action | ||
Console.WriteLine($"Action Name: {action.Name}"); | ||
|
||
//Display the JavaScript code associated with the action | ||
Console.WriteLine($"JavaScript Code: {action.JavaScript}"); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...rieve-Document-Level-JavaScript-Actions/Retrieve-Document-Level-JavaScript-Actions.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>Retrieve_Document_Level_JavaScript_Actions</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="*" /> | ||
</ItemGroup> | ||
|
||
</Project> |
22 changes: 22 additions & 0 deletions
22
...ting-Newly-Added-Annotations-FDF-File/.NET/Exporting-Newly-Added-Annotations-FDF-File.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 added
BIN
+5.55 KB
...Added-Annotations-FDF-File/.NET/Exporting-Newly-Added-Annotations-FDF-File/Data/Input.pdf
Binary file not shown.
15 changes: 15 additions & 0 deletions
15
...orting-Newly-Added-Annotations-FDF-File/Exporting-Newly-Added-Annotations-FDF-File.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Empty file.
30 changes: 30 additions & 0 deletions
30
...wly-Added-Annotations-FDF-File/.NET/Exporting-Newly-Added-Annotations-FDF-File/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...ng-Newly-Added-Annotations-JSON-File/.NET/Exporting-Newly-Added-Annotations-JSON-File.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 added
BIN
+5.55 KB
...ded-Annotations-JSON-File/.NET/Exporting-Newly-Added-Annotations-JSON-File/Data/Input.pdf
Binary file not shown.
15 changes: 15 additions & 0 deletions
15
...ting-Newly-Added-Annotations-JSON-File/Exporting-Newly-Added-Annotations-JSON-File.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Empty file.
29 changes: 29 additions & 0 deletions
29
...y-Added-Annotations-JSON-File/.NET/Exporting-Newly-Added-Annotations-JSON-File/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...ng-Newly-Added-Annotations-XFDF-File/.NET/Exporting-Newly-Added-Annotations-XFDF-File.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 added
BIN
+5.55 KB
...ded-Annotations-XFDF-File/.NET/Exporting-Newly-Added-Annotations-XFDF-File/Data/Input.pdf
Binary file not shown.
15 changes: 15 additions & 0 deletions
15
...ting-Newly-Added-Annotations-XFDF-File/Exporting-Newly-Added-Annotations-XFDF-File.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Empty file.
Oops, something went wrong.