Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

848818- Added the sample for 2023 Volume 3 Release #53

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33417.168
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Get-images-from-the-existing-signed-signature-field", "Get-images-from-the-existing-signed-signature-field\Get-images-from-the-existing-signed-signature-field.csproj", "{A30906C6-E5EF-484B-81D7-EF95CCF50F06}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A30906C6-E5EF-484B-81D7-EF95CCF50F06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A30906C6-E5EF-484B-81D7-EF95CCF50F06}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A30906C6-E5EF-484B-81D7-EF95CCF50F06}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A30906C6-E5EF-484B-81D7-EF95CCF50F06}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EA52E8D5-E680-40DD-B3DF-CBC23E1463E7}
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>net7.0</TargetFramework>
<RootNamespace>Get_images_from_the_existing_signed_signature_field</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

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

</Project>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Syncfusion.Pdf.Interactive;
using Syncfusion.Pdf.Parsing;

namespace Get_images_from_the_existing_signed_signature_field {
internal class Program {
static void Main(string[] args) {
//Load an existing PDF file.
FileStream fileStream = new FileStream(Path.GetFullPath("../../../Input.pdf"), FileMode.Open, FileAccess.Read);
PdfLoadedDocument ldoc = new PdfLoadedDocument(fileStream);
//Get the existing signed signature field.
PdfLoadedSignatureField loadedSignature = ldoc.Form.Fields[0] as PdfLoadedSignatureField;
//Get the image streams.
Stream[] imageStreams = loadedSignature.GetImages();
for (int i = 0; i < imageStreams.Length; i++) {
File.WriteAllBytes("Output" + i.ToString() + ".jpg", (imageStreams[i] as MemoryStream).ToArray());
}
//Close a PDF document.
ldoc.Close(true);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33417.168
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HTML-Header-and-Footer", "HTML-Header-and-Footer\HTML-Header-and-Footer.csproj", "{AE86576C-B426-4EB6-BE05-D07A860BB5B1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AE86576C-B426-4EB6-BE05-D07A860BB5B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE86576C-B426-4EB6-BE05-D07A860BB5B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE86576C-B426-4EB6-BE05-D07A860BB5B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE86576C-B426-4EB6-BE05-D07A860BB5B1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {666C424D-4703-4323-A2B0-6424B87A7BD1}
EndGlobalSection
EndGlobal

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>HTML_Header_and_Footer</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

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

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

namespace HTML_Header_and_Footer {
internal class Program {
static void Main(string[] args) {
//Initialize HTML to PDF converter.
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
//Initialize blink converter settings.
BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();
//Set the Blink viewport size.
blinkConverterSettings.ViewPortSize = new Size(1280, 0);
//Reade the html header and footer text from the html file or you can set html string also.
string headerTemplate = File.ReadAllText(@"..\..\..\Data\header.html");
string footerTemplate = File.ReadAllText(@"..\..\..\Data\footer.html");
//Set the html margin-top value based on the html header height and margin-top value.
blinkConverterSettings.Margin.Top = 70;
//Set the html margin-bottom value based on the html footer height and margin-bottom value.
blinkConverterSettings.Margin.Bottom = 40;
//Set the custom HTML header to add at the top of each page.
blinkConverterSettings.HtmlHeader = headerTemplate;
//Set the custom HTML footer to add at the bottom of each page.
blinkConverterSettings.HtmlFooter = footerTemplate;
//Assign Blink converter settings to the HTML converter.
htmlConverter.ConverterSettings = blinkConverterSettings;
//Convert the URL to a PDF document.
PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com");

//Create a filestream.
FileStream fileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.ReadWrite);
//Save and close a PDF document.
document.Save(fileStream);
document.Close(true);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33417.168
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Remove-specific-keys-from-the-existing-document-information", "Remove-specific-keys-from-the-existing-document-information\Remove-specific-keys-from-the-existing-document-information.csproj", "{BB4C6EB7-449C-4983-A4BD-A39BFF111859}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BB4C6EB7-449C-4983-A4BD-A39BFF111859}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BB4C6EB7-449C-4983-A4BD-A39BFF111859}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB4C6EB7-449C-4983-A4BD-A39BFF111859}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB4C6EB7-449C-4983-A4BD-A39BFF111859}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FB82F6AD-BB98-4EDA-9FE7-CD80EA034DBA}
EndGlobalSection
EndGlobal
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Syncfusion.Pdf.Parsing;

namespace Remove_specific_keys_from_the_existing_document_information {
internal class Program {
static void Main(string[] args) {
//Load an existing PDF document.
FileStream fileStream = new FileStream(Path.GetFullPath("../../../Input.pdf"), FileMode.Open, FileAccess.Read);
PdfLoadedDocument document = new PdfLoadedDocument(fileStream);
//Remove the document information properties.
document.DocumentInformation.Remove("Title");
document.DocumentInformation.Remove("Author");
document.DocumentInformation.Remove("Subject");
document.DocumentInformation.Remove("Keywords");
document.DocumentInformation.Remove("Creator");
document.DocumentInformation.Remove("Producer");
document.DocumentInformation.Remove("ModDate");
document.DocumentInformation.Remove("CreationDate");

//Creating the stream object.
MemoryStream stream = new MemoryStream();
//Save the document into stream.
document.Save(stream);
File.WriteAllBytes("Output.pdf", stream.ToArray());
//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>net7.0</TargetFramework>
<RootNamespace>Remove_specific_keys_from_the_existing_document_information</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

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

</Project>
Loading