Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Forms/Export_checkbox_values/.NET/Export_checkbox_values.sln
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.35707.178 d17.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Export_checkbox_values", "Export_checkbox_values\Export_checkbox_values.csproj", "{7719AB70-75F7-4C57-BC73-0DCEAA9C889A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7719AB70-75F7-4C57-BC73-0DCEAA9C889A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7719AB70-75F7-4C57-BC73-0DCEAA9C889A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7719AB70-75F7-4C57-BC73-0DCEAA9C889A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7719AB70-75F7-4C57-BC73-0DCEAA9C889A}.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,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<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,50 @@
using Syncfusion.Pdf.Interactive;
using Syncfusion.Pdf;
using Syncfusion.Drawing;

//Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a new page to the PDF document.
PdfPage page = document.Pages.Add();

//Create the form.
PdfForm form = document.Form;

//Enable the field auto naming.
form.FieldAutoNaming = false;

//Set default appearance as false.
document.Form.SetDefaultAppearance(false);

// Create First checkbox field
PdfCheckBoxField checkBoxField1 = new PdfCheckBoxField(page, "CheckBox");
checkBoxField1.Bounds = new RectangleF(10, 150, 50, 20);
checkBoxField1.BorderColor = Color.Red;
checkBoxField1.BorderWidth = 3;
checkBoxField1.BackColor = Color.Yellow;

//Set the Export value
checkBoxField1.ExportValue = "Value";
checkBoxField1.Checked = true;

// Add to form
form.Fields.Add(checkBoxField1);

// Create Second checkbox field
PdfCheckBoxField checkBoxField2 = new PdfCheckBoxField(page, "CheckBox");
checkBoxField2.Bounds = new RectangleF(10, 250, 50, 20);
checkBoxField2.BorderColor = Color.Green;
checkBoxField2.BorderWidth = 2;
checkBoxField2.BackColor = Color.YellowGreen;

// Add to form
form.Fields.Add(checkBoxField2);

//Create file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
{
//Save the PDF document to file stream.
document.Save(outputFileStream);
}
//Close the document.
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.35707.178 d17.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Font_Subsetting_in_PDFA_conversion", "Font_Subsetting_in_PDFA_conversion\Font_Subsetting_in_PDFA_conversion.csproj", "{A6B4226C-2B95-4A14-9AF4-465525D9DD48}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A6B4226C-2B95-4A14-9AF4-465525D9DD48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A6B4226C-2B95-4A14-9AF4-465525D9DD48}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6B4226C-2B95-4A14-9AF4-465525D9DD48}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A6B4226C-2B95-4A14-9AF4-465525D9DD48}.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,14 @@
<Project Sdk="Microsoft.NET.Sdk">

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

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

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
using Syncfusion.Pdf.Parsing;
using Syncfusion.Pdf;
using System.Reflection.Metadata;
using Syncfusion.Drawing;
using Syncfusion.Pdf.Graphics;
using SkiaSharp;

//Get stream from an existing PDF document.
FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read);
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);

//Sample level font event handling
loadedDocument.SubstituteFont += LoadedDocument_SubstituteFont;

//Create conformance options
PdfConformanceOptions options = new PdfConformanceOptions();
//Set the conformance level
options.ConformanceLevel = PdfConformanceLevel.Pdf_A1B;

//Embed fonts as subsets
options.SubsetFonts = true;

// Convert to PDF/A conformance
loadedDocument.ConvertToPDFA(options);

//Create file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
{
//Save the PDF document to file stream.
loadedDocument.Save(outputFileStream);
}

//Close the document.
loadedDocument.Close(true);
docStream.Close();

static void LoadedDocument_SubstituteFont(object sender, PdfFontEventArgs args)
{
//get the font name
string fontName = args.FontName.Split(',')[0];

//get the font style
PdfFontStyle fontStyle = args.FontStyle;
SKFontStyle sKFontStyle = SKFontStyle.Normal;

if (fontStyle != PdfFontStyle.Regular)
{
if (fontStyle == PdfFontStyle.Bold)
{
sKFontStyle = SKFontStyle.Bold;
}
else if (fontStyle == PdfFontStyle.Italic)
{
sKFontStyle = SKFontStyle.Italic;
}
else if (fontStyle == (PdfFontStyle.Italic | PdfFontStyle.Bold))
{
sKFontStyle = SKFontStyle.BoldItalic;
}
}

SKTypeface typeface = SKTypeface.FromFamilyName(fontName, sKFontStyle);
SKStreamAsset typeFaceStream = typeface.OpenStream();
MemoryStream memoryStream = null;
if (typeFaceStream != null && typeFaceStream.Length > 0)
{
//Create the fontData from the type face stream.
byte[] fontData = new byte[typeFaceStream.Length];
typeFaceStream.Read(fontData, typeFaceStream.Length);
typeFaceStream.Dispose();

//Create the new memory stream from the font data.
memoryStream = new MemoryStream(fontData);
}

//set the font stream to the event args.
args.FontStream = memoryStream;
}
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.35707.178 d17.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Redaction-fill-color-customization", "Redaction-fill-color-customization\Redaction-fill-color-customization.csproj", "{965B76D5-EB6B-401A-9715-2DAFCAF89573}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{965B76D5-EB6B-401A-9715-2DAFCAF89573}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{965B76D5-EB6B-401A-9715-2DAFCAF89573}.Debug|Any CPU.Build.0 = Debug|Any CPU
{965B76D5-EB6B-401A-9715-2DAFCAF89573}.Release|Any CPU.ActiveCfg = Release|Any CPU
{965B76D5-EB6B-401A-9715-2DAFCAF89573}.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,45 @@
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Interactive;
using Syncfusion.Pdf;
using Syncfusion.Drawing;

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
PdfPage page = document.Pages.Add();

//Create a new Redaction annotation
PdfRedactionAnnotation annot = new PdfRedactionAnnotation();
//Assign the Bounds Value
annot.Bounds = new Rectangle(100, 120, 100, 100);
//Assign the InnerColor
annot.InnerColor = Color.Black;
//Assign the BorderColor
annot.BorderColor = Color.Yellow;

//Assign the AppearanceFillColor
annot.AppearanceFillColor = Color.BlueViolet;

//Assign tbe TextColor
annot.TextColor = Color.Blue;
//Assign the font
annot.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 10);
//Assign the OverlayText
annot.OverlayText = "REDACTION";
//Assign the TextAlignment
annot.TextAlignment = PdfTextAlignment.Right;
//Assign the RepeatText
annot.RepeatText = true;
annot.SetAppearance(true);

//Add the annotation to the page
page.Annotations.Add(annot);

//Create file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
{
//Save the PDF document to file stream.
document.Save(outputFileStream);
}
//Close the document.
document.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>Redaction_fill_color_customization</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.35707.178 d17.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Secure_data _with _AES_GCM", "Secure_data _with _AES_GCM\Secure_data _with _AES_GCM.csproj", "{2B3C8C92-BF50-49A6-AF36-45F094E7CA62}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2B3C8C92-BF50-49A6-AF36-45F094E7CA62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2B3C8C92-BF50-49A6-AF36-45F094E7CA62}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2B3C8C92-BF50-49A6-AF36-45F094E7CA62}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2B3C8C92-BF50-49A6-AF36-45F094E7CA62}.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,44 @@
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Security;
using Syncfusion.Pdf;
using Syncfusion.Drawing;

//Create a new PDF document.
PdfDocument document = new PdfDocument();

//Set the document version as 2.0
document.FileStructure.Version = PdfVersion.Version2_0;

//Add a page to the document.
PdfPage page = document.Pages.Add();

//Create PDF graphics for the page.
PdfGraphics graphics = page.Graphics;

//Set the font.
PdfStandardFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 15f, PdfFontStyle.Bold);

//Set the brush.
PdfBrush brush = PdfBrushes.Black;

//Document security.
PdfSecurity security = document.Security;

//Specifies key size and encryption algorithm.
security.KeySize = PdfEncryptionKeySize.Key256Bit;
security.Algorithm = PdfEncryptionAlgorithm.AESGCM;
security.OwnerPassword = "ownerPassword";
security.UserPassword = "userPassword";

//Draw the text.
graphics.DrawString("Encrypted document with AES-GCM 256bit", font, brush, new PointF(0, 40));

//Create file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
{
//Save the PDF document to file stream.
document.Save(outputFileStream);
}

//Close the documents.
document.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>Secure_data__with__AES_GCM</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

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

</Project>
Loading