Skip to content

Commit

Permalink
927950 Added new feature sample code
Browse files Browse the repository at this point in the history
  • Loading branch information
sameerkhan001 committed Dec 14, 2024
1 parent 86f86cc commit dcb602d
Show file tree
Hide file tree
Showing 29 changed files with 5,118 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}") = "Flatten-specific-types-of-annotations", "Flatten-specific-types-of-annotations\Flatten-specific-types-of-annotations.csproj", "{469F054C-9D3B-4B46-8623-229B66CBCB6C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{469F054C-9D3B-4B46-8623-229B66CBCB6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{469F054C-9D3B-4B46-8623-229B66CBCB6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{469F054C-9D3B-4B46-8623-229B66CBCB6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{469F054C-9D3B-4B46-8623-229B66CBCB6C}.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>Flatten_specific_types_of_annotations</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.Parsing;

//Load the PDF document using a file stream
using (FileStream docStream = new FileStream(Path.GetFullPath(@"Data\Input.pdf"), FileMode.Open, FileAccess.Read))
{
//Load the existing PDF document
using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream))
{
//Specify the annotation types to flatten
PdfLoadedAnnotationType[] pdfLoadedAnnotationTypes = new PdfLoadedAnnotationType[]
{
PdfLoadedAnnotationType.PolygonAnnotation
};

//Flatten the selected annotations
loadedDocument.FlattenAnnotations(pdfLoadedAnnotationTypes);

//Save the flattened document using a file stream
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output\Output.pdf"), FileMode.Create, FileAccess.Write))
{
loadedDocument.Save(outputStream);
}
}
}
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}") = "Set-text-alignment-in-a-Combo-Box-field", "Set-text-alignment-in-a-Combo-Box-field\Set-text-alignment-in-a-Combo-Box-field.csproj", "{724C50AC-603C-4E24-BBA5-17784D364091}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{724C50AC-603C-4E24-BBA5-17784D364091}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{724C50AC-603C-4E24-BBA5-17784D364091}.Debug|Any CPU.Build.0 = Debug|Any CPU
{724C50AC-603C-4E24-BBA5-17784D364091}.Release|Any CPU.ActiveCfg = Release|Any CPU
{724C50AC-603C-4E24-BBA5-17784D364091}.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,20 @@
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Parsing;

// Load an existing document from a file stream.
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Data\Input.pdf"), FileMode.Open, FileAccess.Read))
{
PdfLoadedDocument doc = new PdfLoadedDocument(fileStream);
// Load an existing combo box field by its name.
PdfLoadedComboBoxField comboField = doc.Form.Fields["JobTitle"] as PdfLoadedComboBoxField;
// Set text alignment to center for the combo box field.
comboField.TextAlignment = PdfTextAlignment.Center;

// Save the updated document to a file stream.
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output\Output.pdf"), FileMode.Create, FileAccess.Write))
{
doc.Save(outputStream);
}
// Close the document.
doc.Close(true);
}
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>Set_text_alignment_in_a_Combo_Box_field</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}") = "Customize-the-signed-date", "Customize-the-signed-date\Customize-the-signed-date.csproj", "{5DC85BA0-2790-4226-81A1-438185A892E5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5DC85BA0-2790-4226-81A1-438185A892E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5DC85BA0-2790-4226-81A1-438185A892E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DC85BA0-2790-4226-81A1-438185A892E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DC85BA0-2790-4226-81A1-438185A892E5}.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>Customize_the_signed_date</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

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

</Project>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Syncfusion.Pdf;
using Syncfusion.Pdf.Security;
using Syncfusion.Drawing;

//Create a new PDF document instance.
PdfDocument document = new PdfDocument();
//Add a new page to the PDF document.
PdfPage page = document.Pages.Add();
//Create a digital signature and associate it with the added page.
PdfSignature signature = new PdfSignature(page, "Signature", new DateTime(2020, 12, 24, 10, 50, 10));
//Set the timestamp server for the digital signature.
signature.TimeStampServer = new TimeStampServer(new Uri("http://timestamp.digicert.com"));
//Set the signed name for the signature.
signature.SignedName = "Test";
//Define the bounds for the signature (position and size on the page).
signature.Bounds = new RectangleF(new PointF(0, 0), new SizeF(200, 100));
//Save the document to a file using a file stream.
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Output\Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
{
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}") = "Get-Bounds-in-HTML-file", "Get-Bounds-in-HTML-file\Get-Bounds-in-HTML-file.csproj", "{C675E325-B7B0-40DF-B29C-FB152C83EF0E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C675E325-B7B0-40DF-B29C-FB152C83EF0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C675E325-B7B0-40DF-B29C-FB152C83EF0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C675E325-B7B0-40DF-B29C-FB152C83EF0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C675E325-B7B0-40DF-B29C-FB152C83EF0E}.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,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>10 Lines of Paragraph</title>
</head>
<body>
<p>
Line 1: This is the first line of the paragraph.<br>
Line 2: Here comes the second line.<br>
Line 3: Continuing with the third line.<br>
Line 4: Fourth line is also important.<br>
Line 5: Now, we reach the halfway point.<br>
Line 6: The sixth line brings more information.<br>
Line 7: Moving on to the seventh line.<br>
Line 8: Eighth line follows closely behind.<br>
Line 9: We're almost done with the ninth line.<br>
Line 10: Finally, this is the tenth and last line of the paragraph.
</p>
</body>
</html>
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>Get_Bounds_in_HTML_file</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.HtmlToPdfConverter.Net.Windows" Version="*" />
</ItemGroup>

</Project>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Syncfusion.Drawing;
using Syncfusion.HtmlConverter;

// Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
// Initialize Blink converter settings
BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();

// Set the crop region for the HTML conversion based on the bounds of the HTML file
blinkConverterSettings.CropRegion = htmlConverter.GetHtmlBounds(Path.GetFullPath(@"Data\Input.html"));

// Assign Blink converter settings to the HTML converter
htmlConverter.ConverterSettings = blinkConverterSettings;
// Convert the HTML file to an image
Image image = htmlConverter.ConvertToImage(Path.GetFullPath(@"Data\Input.html"));
// Save the image as a PNG file
File.WriteAllBytes(Path.GetFullPath(@"Output\Output.png"), image.ImageData);
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}") = "HTML-to-PDF-Enable-Autoscaling", "HTML-to-PDF-Enable-Autoscaling\HTML-to-PDF-Enable-Autoscaling.csproj", "{0C431F60-9A1D-4ECA-BF9C-FC3CD6D9F239}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0C431F60-9A1D-4ECA-BF9C-FC3CD6D9F239}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C431F60-9A1D-4ECA-BF9C-FC3CD6D9F239}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C431F60-9A1D-4ECA-BF9C-FC3CD6D9F239}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C431F60-9A1D-4ECA-BF9C-FC3CD6D9F239}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Loading

0 comments on commit dcb602d

Please sign in to comment.