Skip to content

Commit

Permalink
Merge pull request #122 from SyncfusionExamples/927950
Browse files Browse the repository at this point in the history
927950 Added new feature sample projects in Volume 4 main release
  • Loading branch information
chinnumuniyappan authored Dec 16, 2024
2 parents bc3af65 + e1c959d commit 39fcb52
Show file tree
Hide file tree
Showing 57 changed files with 5,498 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}") = "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
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>
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);
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 not shown.
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);
}
}
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>
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 not shown.
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}");
}
}
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>
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>
Loading

0 comments on commit 39fcb52

Please sign in to comment.