Skip to content

Commit 7ab99e1

Browse files
committed
949285 Added Sample Code for 2025 Volume 1 Main Release PDF Features.
1 parent da0b3df commit 7ab99e1

File tree

24 files changed

+662
-0
lines changed

24 files changed

+662
-0
lines changed
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35707.178 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hatch-brush", "Hatch-brush\Hatch-brush.csproj", "{43313999-B898-44C1-A495-D25C2280888A}"
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+
{43313999-B898-44C1-A495-D25C2280888A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{43313999-B898-44C1-A495-D25C2280888A}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{43313999-B898-44C1-A495-D25C2280888A}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{43313999-B898-44C1-A495-D25C2280888A}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Hatch_brush</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="*" />
13+
</ItemGroup>
14+
15+
</Project>

Brushes/Hatch-brush/.NET/Hatch-brush/Output/gitkeep.txt

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using Syncfusion.Pdf.Graphics;
2+
using Syncfusion.Pdf;
3+
using Syncfusion.Drawing;
4+
5+
//Create a new PDF document
6+
PdfDocument document = new PdfDocument();
7+
//Add a page to the document
8+
PdfPage page = document.Pages.Add();
9+
//Create PDF graphics for the page
10+
PdfGraphics graphics = page.Graphics;
11+
//Define colors for the hatch brush
12+
Color systemForeColor = Color.FromArgb(255, 255, 255, 0);
13+
Color systemBackColor = Color.FromArgb(255, 78, 167, 46);
14+
15+
// Create a new PDF hatch brush with a pattern and colors
16+
PdfHatchBrush pdfHatchBrush = new PdfHatchBrush(PdfHatchStyle.Plaid, new PdfColor(systemForeColor), new PdfColor(systemBackColor));
17+
18+
//Draw rectangle on the page
19+
graphics.DrawRectangle(PdfPens.Black, pdfHatchBrush, new Rectangle(100, 100, 300, 200));
20+
21+
//Create file stream.
22+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
23+
{
24+
//Save the PDF document to file stream.
25+
document.Save(outputFileStream);
26+
}
27+
//Close the document.
28+
document.Close(true);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35707.178 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Custom-Role-Mapping", "Custom-Role-Mapping\Custom-Role-Mapping.csproj", "{F3023308-36C9-4327-877C-5CBF1D06AB72}"
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+
{F3023308-36C9-4327-877C-5CBF1D06AB72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{F3023308-36C9-4327-877C-5CBF1D06AB72}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{F3023308-36C9-4327-877C-5CBF1D06AB72}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{F3023308-36C9-4327-877C-5CBF1D06AB72}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Custom_Role_Mapping</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="*" />
13+
</ItemGroup>
14+
15+
</Project>
Binary file not shown.

Tagged PDF/Custom-Role-Mapping/.NET/Custom-Role-Mapping/Output/gitkeep.txt

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using Syncfusion.Pdf.Graphics;
2+
using Syncfusion.Pdf;
3+
using Syncfusion.Drawing;
4+
5+
// Create a new PDF document
6+
PdfDocument document = new PdfDocument();
7+
8+
// Create a role map to define custom structure roles
9+
PdfRoleMap roleMap = new PdfRoleMap();
10+
roleMap.Add("WorkBook", "Document"); // Mapping "WorkBook" to "Document"
11+
roleMap.Add("WorkSheet", "Sect"); // Mapping "WorkSheet" to "Sect"
12+
13+
// Define a custom structure type
14+
string customStructureType = "WorkBook";
15+
string standardStructureType = "";
16+
17+
// Try to get the standard structure type for the custom role
18+
bool found = roleMap.TryGetStandardType(customStructureType, out standardStructureType);
19+
document.StructureRoleMap = roleMap; // Assign role map to the document
20+
21+
// Set document metadata
22+
document.DocumentInformation.Title = "PdfTextElement";
23+
24+
// Add a new page to the PDF
25+
PdfPage page = document.Pages.Add();
26+
27+
// Create a custom structure element with a specified role
28+
PdfStructureElement structureElement = new PdfStructureElement("WorkBook");
29+
structureElement.ActualText = "Simple paragraph element"; // Set alternative text for accessibility
30+
31+
// Define the content text
32+
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.";
33+
34+
// Create a text element and associate it with the structure element
35+
PdfTextElement element = new PdfTextElement(text);
36+
element.PdfTag = structureElement;
37+
38+
//Load the font file as stream
39+
FileStream fontStream = new FileStream(Path.GetFullPath(@"Data/Font.ttf"), FileMode.Open, FileAccess.Read);
40+
41+
// Set font and color for the text
42+
element.Font = new PdfTrueTypeFont(fontStream, 10);
43+
element.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
44+
45+
// Draw text on the page
46+
PdfLayoutResult result = element.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width, 200));
47+
48+
//Create file stream.
49+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
50+
{
51+
//Save the PDF document to file stream.
52+
document.Save(outputFileStream);
53+
}
54+
//Close the document.
55+
document.Close(true);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35707.178 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDF-for-Universal-Accessibility", "PDF-for-Universal-Accessibility\PDF-for-Universal-Accessibility.csproj", "{C4C14E31-D7E7-461D-BBE1-45E558A705B1}"
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+
{C4C14E31-D7E7-461D-BBE1-45E558A705B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{C4C14E31-D7E7-461D-BBE1-45E558A705B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{C4C14E31-D7E7-461D-BBE1-45E558A705B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{C4C14E31-D7E7-461D-BBE1-45E558A705B1}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal

Tagged PDF/PDF-for-Universal-Accessibility/.NET/PDF-for-Universal-Accessibility/Output/gitkeep.txt

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>PDF_for_Universal_Accessibility</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="*" />
13+
</ItemGroup>
14+
15+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using Syncfusion.Pdf.Graphics;
2+
using Syncfusion.Pdf;
3+
using Syncfusion.Drawing;
4+
5+
//Create a new PDF document
6+
PdfDocument document = new PdfDocument();
7+
8+
//Set Pdf File version 2.0
9+
document.FileStructure.Version = PdfVersion.Version2_0;
10+
11+
//Set true to auto tag all elements in document
12+
document.AutoTag = true;
13+
document.DocumentInformation.Title = "PdfTextElement";
14+
15+
// Add a new page
16+
PdfPage page = document.Pages.Add();
17+
18+
//Load the font file as stream
19+
FileStream fontStream = new FileStream(Path.GetFullPath(@"Data/Font.ttf"), FileMode.Open, FileAccess.Read);
20+
21+
// Initialize the structure element with tag type paragraph
22+
PdfStructureElement paragraphStructure = new PdfStructureElement(PdfTagType.Paragraph);
23+
24+
// Represents the text that is the exact replacement for PdfTextElement
25+
paragraphStructure.ActualText = "Simple paragraph element";
26+
string paragraphText = "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.";
27+
28+
// Initialize the PDF text element
29+
PdfTextElement textElement = new PdfTextElement(paragraphText);
30+
31+
// Adding tag to the text element
32+
textElement.PdfTag = paragraphStructure;
33+
34+
// Create font for the text element
35+
textElement.Font = new PdfTrueTypeFont(fontStream, 10);
36+
textElement.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
37+
38+
// Draw text element with tag
39+
textElement.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width, 200));
40+
41+
//Create file stream.
42+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
43+
{
44+
//Save the PDF document to file stream.
45+
document.Save(outputFileStream);
46+
}
47+
//Close the document.
48+
document.Close(true);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35707.178 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Well-Tagged-PDF", "Well-Tagged-PDF\Well-Tagged-PDF.csproj", "{27A4CC9D-7C18-4483-A89C-7A68D22AB5FC}"
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+
{27A4CC9D-7C18-4483-A89C-7A68D22AB5FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{27A4CC9D-7C18-4483-A89C-7A68D22AB5FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{27A4CC9D-7C18-4483-A89C-7A68D22AB5FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{27A4CC9D-7C18-4483-A89C-7A68D22AB5FC}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Binary file not shown.

Tagged PDF/Well-Tagged-PDF/.NET/Well-Tagged-PDF/Output/gitkeep.txt

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using Syncfusion.Pdf.Graphics;
2+
using Syncfusion.Pdf;
3+
using Syncfusion.Drawing;
4+
5+
//Create a new PDF document
6+
PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A4);
7+
8+
//Set Pdf File version 2.0
9+
document.FileStructure.Version = PdfVersion.Version2_0;
10+
11+
//Set true to auto tag all elements in document
12+
document.AutoTag = true;
13+
document.DocumentInformation.Title = "PdfTextElement";
14+
15+
// Add a new page
16+
PdfPage page = document.Pages.Add();
17+
18+
//Load the font file as stream
19+
FileStream fontStream = new FileStream(Path.GetFullPath(@"Data/Font.ttf"), FileMode.Open, FileAccess.Read);
20+
21+
// Initialize the structure element with tag type paragraph
22+
PdfStructureElement paragraphStructure = new PdfStructureElement(PdfTagType.Paragraph);
23+
24+
// Represents the text that is the exact replacement for PdfTextElement
25+
paragraphStructure.ActualText = "Simple paragraph element";
26+
string paragraphText = "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.";
27+
28+
// Initialize the PDF text element
29+
PdfTextElement textElement = new PdfTextElement(paragraphText);
30+
31+
// Adding tag to the text element
32+
textElement.PdfTag = paragraphStructure;
33+
34+
// Create font for the text element
35+
textElement.Font = new PdfTrueTypeFont(fontStream, 10);
36+
textElement.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
37+
38+
// Draw text element with tag
39+
textElement.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width, 200));
40+
41+
//Create file stream.
42+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
43+
{
44+
//Save the PDF document to file stream.
45+
document.Save(outputFileStream);
46+
}
47+
//Close the document.
48+
document.Close(true);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Well_Tagged_PDF</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="*" />
13+
</ItemGroup>
14+
15+
</Project>

ZUGFeRD/Factur-X/.NET/Factur-X.sln

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35707.178 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Factur-X", "Factur-X\Factur-X.csproj", "{48333744-D512-43D0-A937-20333130A1E1}"
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+
{48333744-D512-43D0-A937-20333130A1E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{48333744-D512-43D0-A937-20333130A1E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{48333744-D512-43D0-A937-20333130A1E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{48333744-D512-43D0-A937-20333130A1E1}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal

0 commit comments

Comments
 (0)