Skip to content

Commit

Permalink
890511: Volume 2 Feature samples.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sri-hari-haran-g committed Jun 12, 2024
1 parent 9e7ea05 commit 9e88644
Show file tree
Hide file tree
Showing 52 changed files with 958 additions and 0 deletions.
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.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Merge-PDF-without-compromising-accessibility-tags", "Merge-PDF-without-compromising-accessibility-tags\Merge-PDF-without-compromising-accessibility-tags.csproj", "{8A90913D-85DA-4783-866B-07AFD31C24EA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8A90913D-85DA-4783-866B-07AFD31C24EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A90913D-85DA-4783-866B-07AFD31C24EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A90913D-85DA-4783-866B-07AFD31C24EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A90913D-85DA-4783-866B-07AFD31C24EA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {96E27875-8979-4CDE-826F-2C236D45090B}
EndGlobalSection
EndGlobal
Binary file not shown.
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>Merge_PDF_without_compromising_accessibility_tags</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Pdf.NET" Version="26.1.35" />
</ItemGroup>

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

//Create a PDF document.
PdfDocument finalDoc = new PdfDocument();
//Get stream from the PDF documents.
FileStream stream1 = new FileStream(Path.GetFullPath("../../../File1.pdf"), FileMode.Open, FileAccess.Read);
FileStream stream2 = new FileStream(Path.GetFullPath("../../../File2.pdf"), FileMode.Open, FileAccess.Read);

//Create a PDF stream for merging.
Stream[] streams = { stream1, stream2 };
PdfMergeOptions mergeOptions = new PdfMergeOptions();

//Enable the Merge Accessibility Tags.
mergeOptions.MergeAccessibilityTags = true;

//Merge PDFDocument.
PdfDocumentBase.Merge(finalDoc, mergeOptions, streams);

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

//Close the documents.
finalDoc.Close(true);

//Dispose the stream.
stream1.Dispose();
stream2.Dispose();
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.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inserting-duplicate-pages-in-the-existing-pdf", "Inserting-duplicate-pages-in-the-existing-pdf\Inserting-duplicate-pages-in-the-existing-pdf.csproj", "{2E9488A2-D46D-45ED-9082-89FA4BE13A10}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2E9488A2-D46D-45ED-9082-89FA4BE13A10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E9488A2-D46D-45ED-9082-89FA4BE13A10}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E9488A2-D46D-45ED-9082-89FA4BE13A10}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E9488A2-D46D-45ED-9082-89FA4BE13A10}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A26DD0FA-AFEF-488C-B795-4C053B656C57}
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>Inserting_duplicate_pages_in_the_existing_pdf</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Pdf.NET" Version="26.1.35" />
</ItemGroup>

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

//Load the PDF document.
FileStream docStream = new FileStream("../../../Input.pdf", FileMode.Open, FileAccess.Read);

PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);

//Gets the page

PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;

//Inserts the duplicate page in the beginning of the document.

loadedDocument.Pages.Insert(0, loadedPage);



//Creating the stream object.

MemoryStream stream = new MemoryStream();

//Save the document as stream.

loadedDocument.Save(stream);

File.WriteAllBytes("../../../Output.pdf", stream.ToArray());
//Close the document.

loadedDocument.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.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Extract-each-characters-from-an-existing-PDF-document", "Extract-each-characters-from-an-existing-PDF-document\Extract-each-characters-from-an-existing-PDF-document.csproj", "{D63E18E4-EDD0-41F4-ADD3-72111CB94557}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D63E18E4-EDD0-41F4-ADD3-72111CB94557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D63E18E4-EDD0-41F4-ADD3-72111CB94557}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D63E18E4-EDD0-41F4-ADD3-72111CB94557}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D63E18E4-EDD0-41F4-ADD3-72111CB94557}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A61641D4-5B52-47F0-9443-DB23FEC9111F}
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>Extract_each_characters_from_an_existing_PDF_document</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Pdf.NET" Version="26.1.35" />
</ItemGroup>

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


//Get stream from an existing PDF document.
FileStream docStream = new FileStream(Path.GetFullPath("../../../Input.pdf"), FileMode.Open, FileAccess.Read);
//Load the existing PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
//Get the first page of the loaded PDF document
PdfPageBase page = loadedDocument.Pages[0];
TextLineCollection lineCollection = new TextLineCollection();
//Extract text from the first page
string m_extractedText = page.ExtractText(out lineCollection);
//Gets specific line from the collection
TextLine line = lineCollection.TextLine[0];
//Gets collection of the words in the line
List<TextWord> textWordCollection = line.WordCollection;
//Gets word from the collection using index
TextWord textWord = textWordCollection[0];
// Gets Glyph details of the word
List<TextGlyph> textGlyphCollection = textWord.Glyphs;
//Gets character of the word
TextGlyph textGlyph = textGlyphCollection[0];
//Gets bounds of the character
RectangleF glyphBounds = textGlyph.Bounds;
//Gets font name of the character
string GlyphFontName = textGlyph.FontName;
//Gets font size of the character
float GlyphFontSize = textGlyph.FontSize;
//Gets font style of the character
FontStyle GlyphFontStyle = textGlyph.FontStyle;
//Gets character in the word
char GlyphText = textGlyph.Text;
//Gets the color of the character
Color GlyphColor = textGlyph.TextColor;
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.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Customizing-truetype-fonts-in-a-PDF", "Customizing-truetype-fonts-in-a-PDF\Customizing-truetype-fonts-in-a-PDF.csproj", "{E8ED28CA-BE49-4D3E-BD66-4E0007A3CE49}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E8ED28CA-BE49-4D3E-BD66-4E0007A3CE49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E8ED28CA-BE49-4D3E-BD66-4E0007A3CE49}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E8ED28CA-BE49-4D3E-BD66-4E0007A3CE49}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E8ED28CA-BE49-4D3E-BD66-4E0007A3CE49}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {831D183F-99A1-4491-81F8-51B5BD03D68B}
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>Customizing_truetype_fonts_in_a_PDF</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Pdf.NET" Version="26.1.35" />
</ItemGroup>

</Project>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

//Create a new PDF document.
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf;
using Syncfusion.Drawing;
using Syncfusion.Pdf.Graphics.Fonts;

PdfDocument document = new PdfDocument();
//Add a page to the document.
PdfPage page = document.Pages.Add();
//Create PDF graphics for the page.
PdfGraphics graphics = page.Graphics;
//Load the TrueType font from the local *.ttf file.
FileStream fontStream = new FileStream("../../../arial.ttf", FileMode.Open, FileAccess.Read);
// Initialize the PdfFontSettings
PdfFontSettings fontSettings = new PdfFontSettings(10, PdfFontStyle.Bold, true, true, true);
PdfFont pdfFont = new PdfTrueTypeFont(fontStream, fontSettings);
//Draw the text.
graphics.DrawString("Hello World!!!", pdfFont, PdfBrushes.Black, new PointF(0, 0));
//Save the document into stream.
MemoryStream stream = new MemoryStream();
document.Save(stream);
File.WriteAllBytes("../../../Output.pdf", stream.ToArray());
//Close the document.
document.Close(true);
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"Customizing-truetype-fonts-in-a-PDF/1.0.0": {
"dependencies": {
"Syncfusion.Pdf.NET": "26.1.35"
},
"runtime": {
"Customizing-truetype-fonts-in-a-PDF.dll": {}
}
},
"Syncfusion.Compression.NET/26.1.35": {
"runtime": {
"lib/net8.0/Syncfusion.Compression.NET.dll": {
"assemblyVersion": "26.1.35.0",
"fileVersion": "26.1.35.0"
}
}
},
"Syncfusion.Licensing/26.1.35": {
"runtime": {
"lib/net8.0/Syncfusion.Licensing.dll": {
"assemblyVersion": "26.1.35.0",
"fileVersion": "26.1.35.0"
}
}
},
"Syncfusion.Pdf.NET/26.1.35": {
"dependencies": {
"Syncfusion.Compression.NET": "26.1.35",
"Syncfusion.Licensing": "26.1.35",
"System.Text.Encoding.CodePages": "6.0.0"
},
"runtime": {
"lib/net8.0/Syncfusion.Pdf.NET.dll": {
"assemblyVersion": "26.1.35.0",
"fileVersion": "26.1.35.0"
}
}
},
"System.Runtime.CompilerServices.Unsafe/6.0.0": {},
"System.Text.Encoding.CodePages/6.0.0": {
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
}
}
},
"libraries": {
"Customizing-truetype-fonts-in-a-PDF/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Syncfusion.Compression.NET/26.1.35": {
"type": "package",
"serviceable": true,
"sha512": "sha512-15aZwfkvwySU8E5HTNm4KLQNsjDRSelzAEiLxG4uSpBGXse2S25hMXuHZdX3geE+5aqFi2gnDDO8rruaNAAQRw==",
"path": "syncfusion.compression.net/26.1.35",
"hashPath": "syncfusion.compression.net.26.1.35.nupkg.sha512"
},
"Syncfusion.Licensing/26.1.35": {
"type": "package",
"serviceable": true,
"sha512": "sha512-uYFGMFrJv1Cdbobgu79/6JhgmwmZxI8UXIGlClBUeQS5+KIAUT1zL5bgnAZS/PfNkgVLFTOFoAeWQSunj5yPLA==",
"path": "syncfusion.licensing/26.1.35",
"hashPath": "syncfusion.licensing.26.1.35.nupkg.sha512"
},
"Syncfusion.Pdf.NET/26.1.35": {
"type": "package",
"serviceable": true,
"sha512": "sha512-K7DkLUFwoYrKAqCTmV5nmzl0/vYgQ6SULGdQX/kbWrRZHyPsFaCYccQvqONNNxmb27SHCHHQ9Zdh9v+5TBGE+Q==",
"path": "syncfusion.pdf.net/26.1.35",
"hashPath": "syncfusion.pdf.net.26.1.35.nupkg.sha512"
},
"System.Runtime.CompilerServices.Unsafe/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==",
"path": "system.runtime.compilerservices.unsafe/6.0.0",
"hashPath": "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512"
},
"System.Text.Encoding.CodePages/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ZFCILZuOvtKPauZ/j/swhvw68ZRi9ATCfvGbk1QfydmcXBkIWecWKn/250UH7rahZ5OoDBaiAudJtPvLwzw85A==",
"path": "system.text.encoding.codepages/6.0.0",
"hashPath": "system.text.encoding.codepages.6.0.0.nupkg.sha512"
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 9e88644

Please sign in to comment.