Skip to content

Commit 6dcad26

Browse files
Merge pull request #1 from SyncfusionExamples/EJDOTNETCORE-4254
EJDOTNETCORE-4254 Added the README.md file and sample project
2 parents afc0582 + 798b39c commit 6dcad26

File tree

15 files changed

+332
-2
lines changed

15 files changed

+332
-2
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.32901.82
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDF_conformance_with_tags", "PDF_conformance_with_tags\PDF_conformance_with_tags.csproj", "{3932D5D1-E9AC-4FAC-9EB6-EBB739FF2BE3}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{3932D5D1-E9AC-4FAC-9EB6-EBB739FF2BE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{3932D5D1-E9AC-4FAC-9EB6-EBB739FF2BE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{3932D5D1-E9AC-4FAC-9EB6-EBB739FF2BE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{3932D5D1-E9AC-4FAC-9EB6-EBB739FF2BE3}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {C39C3311-9FD3-4DEA-9AC6-FDFA091D0066}
24+
EndGlobalSection
25+
EndGlobal
Binary file not shown.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="20.3.0.59" />
10+
</ItemGroup>
11+
12+
</Project>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
using System.IO;
3+
using Syncfusion.Drawing;
4+
using Syncfusion.Pdf;
5+
using Syncfusion.Pdf.Graphics;
6+
7+
namespace PDF_conformance_with_tags
8+
{
9+
class Program
10+
{
11+
static void Main(string[] args)
12+
{
13+
//Create new PDF document.
14+
using (PdfDocument doc = new PdfDocument(PdfConformanceLevel.Pdf_A3A))
15+
{
16+
//Enable auto-tagging.
17+
doc.AutoTag = true;
18+
//Set the document title.
19+
doc.DocumentInformation.Title = "PDF conformance";
20+
//Create new page.
21+
PdfPage page = doc.Pages.Add();
22+
string text = "Adventure Works Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company. The company manufactures and sells metal and composite bicycles to North American, European and Asian commercial markets. While its base operation is located in Washington with 290 employees, several regional sales teams are located throughout their market base.";
23+
//Initialize the PDF text element.
24+
PdfTextElement element = new PdfTextElement(text);
25+
FileStream fontStream = new FileStream(@"../../../Data/Arial.ttf", FileMode.Open, FileAccess.Read);
26+
PdfFont font = new PdfTrueTypeFont(fontStream, 14);
27+
//Create font for the text element.
28+
element.Font = font;
29+
element.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
30+
//Draw text element with tag.
31+
element.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width, 200));
32+
FileStream output = new FileStream("PDFA3a.pdf", FileMode.CreateNew);
33+
//Save the document.
34+
doc.Save(output);
35+
}
36+
}
37+
}
38+
}

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,36 @@
1-
# create-accessible-pdf-csharp
2-
This repository contains examples to create a new tagged PDF document and converting word to tagged PDF using Syncfusion PDF library.
1+
# Create PDF Documents Using C#
2+
The [Syncfusion .NET PDF library](https://www.syncfusion.com/document-processing/pdf-framework/net) allows you can easily create a tagged PDF document. This repository contains examples to create a new tagged PDF document and converting word to tagged PDF using Syncfusion PDF library.
3+
4+
Sample name | Description
5+
--- | ---
6+
[Simple accessible PDF](https://github.com/SyncfusionExamples/create-accessible-pdf-csharp/blob/master/create_accessible_PDF) | Create a simple accessible PDF document.
7+
[Auto-tag PDF](https://github.com/SyncfusionExamples/create-accessible-pdf-csharp/blob/master/create_autotag_PDF) | Auto-tag feature to automatically tag PDF elements with the appropriate tag types.
8+
[PDF conformance with tags](https://github.com/SyncfusionExamples/create-accessible-pdf-csharp/blob/master/PDF_conformance_with_tags) | Create a PDF conformance document with accessibility tags.
9+
[Word to PDF document with tags](https://github.com/SyncfusionExamples/create-accessible-pdf-csharp/blob/master/word_to_PDF_with_tags) | Convert a Word to PDF document with tags.
10+
11+
# How to run the examples
12+
* Download this project to a location in your disk.
13+
* Open the solution file using Visual Studio.
14+
* Rebuild the solution to install the required NuGet package.
15+
* Run the application.
16+
17+
# Resources
18+
* **Product page:** [Syncfusion PDF Framework](https://www.syncfusion.com/document-processing/pdf-framework/net)
19+
* **Documentation page:** [Syncfusion .NET PDF library](https://help.syncfusion.com/file-formats/pdf/overview)
20+
* **Online demo:** [Syncfusion .NET PDF library - Online demos](https://ej2.syncfusion.com/aspnetcore/PDF/CompressExistingPDF#/bootstrap5)
21+
* **Blog:** [Syncfusion .NET PDF library - Blog](https://www.syncfusion.com/blogs/category/pdf)
22+
* **Knowledge Base:** [Syncfusion .NET PDF library - Knowledge Base](https://www.syncfusion.com/kb/windowsforms/pdf)
23+
* **EBooks:** [Syncfusion .NET PDF library - EBooks](https://www.syncfusion.com/succinctly-free-ebooks)
24+
* **FAQ:** [Syncfusion .NET PDF library - FAQ](https://www.syncfusion.com/faq/)
25+
26+
# Support and feedback
27+
* For any other queries, reach our [Syncfusion support team](https://www.syncfusion.com/support/directtrac/incidents/newincident?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) or post the queries through the [community forums](https://www.syncfusion.com/forums?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples).
28+
* Request new feature through [Syncfusion feedback portal](https://www.syncfusion.com/feedback?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples).
29+
30+
# License
31+
This is a commercial product and requires a paid license for possession or use. Syncfusion’s licensed software, including this component, is subject to the terms and conditions of [Syncfusion's EULA](https://www.syncfusion.com/eula/es/?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples). You can purchase a licnense [here](https://www.syncfusion.com/sales/products?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) or start a free 30-day trial [here](https://www.syncfusion.com/account/manage-trials/start-trials?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples).
32+
33+
# About Syncfusion
34+
Founded in 2001 and headquartered in Research Triangle Park, N.C., Syncfusion has more than 26,000+ customers and more than 1 million users, including large financial institutions, Fortune 500 companies, and global IT consultancies.
35+
36+
Today, we provide 1600+ components and frameworks for web ([Blazor](https://www.syncfusion.com/blazor-components?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [ASP.NET Core](https://www.syncfusion.com/aspnet-core-ui-controls?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [ASP.NET MVC](https://www.syncfusion.com/aspnet-mvc-ui-controls?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [ASP.NET WebForms](https://www.syncfusion.com/jquery/aspnet-webforms-ui-controls?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [JavaScript](https://www.syncfusion.com/javascript-ui-controls?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [Angular](https://www.syncfusion.com/angular-ui-components?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [React](https://www.syncfusion.com/react-ui-components?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [Vue](https://www.syncfusion.com/vue-ui-components?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), and [Flutter](https://www.syncfusion.com/flutter-widgets?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples)), mobile ([Xamarin](https://www.syncfusion.com/xamarin-ui-controls?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [Flutter](https://www.syncfusion.com/flutter-widgets?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [UWP](https://www.syncfusion.com/uwp-ui-controls?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), and [JavaScript](https://www.syncfusion.com/javascript-ui-controls?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples)), and desktop development ([WinForms](https://www.syncfusion.com/winforms-ui-controls?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [WPF](https://www.syncfusion.com/wpf-ui-controls?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [WinUI(Preview)](https://www.syncfusion.com/winui-controls?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [Flutter](https://www.syncfusion.com/flutter-widgets?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) and [UWP](https://www.syncfusion.com/uwp-ui-controls?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples)). We provide ready-to-deploy enterprise software for dashboards, reports, data integration, and big data processing. Many customers have saved millions in licensing fees by deploying our software.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.32901.82
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "create_accessible_PDF", "create_accessible_PDF\create_accessible_PDF.csproj", "{545ED43D-5EE9-45B7-BBEA-4DE5F0E679BC}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{545ED43D-5EE9-45B7-BBEA-4DE5F0E679BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{545ED43D-5EE9-45B7-BBEA-4DE5F0E679BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{545ED43D-5EE9-45B7-BBEA-4DE5F0E679BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{545ED43D-5EE9-45B7-BBEA-4DE5F0E679BC}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {BA9C2C03-E6AC-46E6-BC19-693E13AD943A}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System;
2+
using System.IO;
3+
using Syncfusion.Drawing;
4+
using Syncfusion.Pdf;
5+
using Syncfusion.Pdf.Graphics;
6+
7+
namespace create_accessible_PDF
8+
{
9+
class Program
10+
{
11+
static void Main(string[] args)
12+
{
13+
14+
//Create new PDF document.
15+
using (PdfDocument doc = new PdfDocument())
16+
{
17+
//Set the document title.
18+
doc.DocumentInformation.Title = "PdfTextElement";
19+
//Create a new page.
20+
PdfPage page = doc.Pages.Add();
21+
//Initialize the structure element with tag type paragraph.
22+
PdfStructureElement structureElement = new PdfStructureElement(PdfTagType.Paragraph);
23+
//Represents the text that is the exact replacement for PdfTextElement.
24+
structureElement.ActualText = "Simple paragraph element";
25+
string text = "Adventure Works Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company. The company manufactures and sells metal and composite bicycles to North American, European, and Asian commercial markets. While its base operation is located in Washington with 290 employees, several regional sales teams are located throughout their market base.";
26+
//Initialize the PDF text element.
27+
PdfTextElement element = new PdfTextElement(text);
28+
//Adding tag to the text element.
29+
element.PdfTag = structureElement;
30+
//Create font for the text element.
31+
element.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
32+
element.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
33+
//Draw text element with tag.
34+
element.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width, 200));
35+
FileStream output = new FileStream("TaggedPDF.pdf", FileMode.CreateNew);
36+
//Save the document.
37+
doc.Save(output);
38+
}
39+
}
40+
}
41+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="20.3.0.59" />
10+
</ItemGroup>
11+
12+
</Project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.32901.82
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "create_autotag_PDF", "create_autotag_PDF\create_autotag_PDF.csproj", "{5CD8C5CC-5665-44A4-A6A4-035D742A6ED5}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{5CD8C5CC-5665-44A4-A6A4-035D742A6ED5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{5CD8C5CC-5665-44A4-A6A4-035D742A6ED5}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{5CD8C5CC-5665-44A4-A6A4-035D742A6ED5}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{5CD8C5CC-5665-44A4-A6A4-035D742A6ED5}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {CD9B2802-8523-4BE8-A1E2-6138269494AC}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System;
2+
using System.IO;
3+
using Syncfusion.Drawing;
4+
using Syncfusion.Pdf;
5+
using Syncfusion.Pdf.Graphics;
6+
7+
namespace create_autotag_PDF
8+
{
9+
class Program
10+
{
11+
static void Main(string[] args)
12+
{
13+
using (PdfDocument doc = new PdfDocument())
14+
{
15+
//Enable auto-tagging.
16+
doc.AutoTag = true;
17+
//Set the document title.
18+
doc.DocumentInformation.Title = "PdfTextElement";
19+
//Create new page.
20+
PdfPage page = doc.Pages.Add();
21+
string text = "Adventure Works Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company. The company manufactures and sells metal and composite bicycles to North American, European and Asian commercial markets. While its base operation is located in Washington with 290 employees, several regional sales teams are located throughout their market base.";
22+
//Initialize the PDF text element.
23+
PdfTextElement element = new PdfTextElement(text);
24+
//Create font for the text element.
25+
element.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
26+
element.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
27+
//Draw text element with tag.
28+
element.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width, 200));
29+
FileStream output = new FileStream("Auto-tagging.pdf", FileMode.CreateNew);
30+
//Save the document.
31+
doc.Save(output);
32+
}
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)