-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Committed the samples for the below topics.
Working with Attachment Working with Barcode Working with Bookmarks Working with Header and Footer Working with Hyperlinks Working with Image Extraction Merge PDF documents PDF Templates Working with Security Working with Shapes Working with Table Working with Text Extraction
- Loading branch information
1 parent
67c05d9
commit 334c2a2
Showing
427 changed files
with
9,608 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
Attachment/Adding-attachment-to-a-PDF-document/.NET/Adding-attachment-to-a-PDF-document.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.1.32407.343 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Adding-attachment-to-a-PDF-document", "Adding-attachment-to-a-PDF-document\Adding-attachment-to-a-PDF-document.csproj", "{CF6C4C9C-A9F6-4C5B-90E7-046DA33765CE}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{CF6C4C9C-A9F6-4C5B-90E7-046DA33765CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{CF6C4C9C-A9F6-4C5B-90E7-046DA33765CE}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{CF6C4C9C-A9F6-4C5B-90E7-046DA33765CE}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{CF6C4C9C-A9F6-4C5B-90E7-046DA33765CE}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {3B9561AB-79AC-439B-862F-30C4E017A13C} | ||
EndGlobalSection | ||
EndGlobal |
15 changes: 15 additions & 0 deletions
15
...ument/.NET/Adding-attachment-to-a-PDF-document/Adding-attachment-to-a-PDF-document.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<RootNamespace>Adding_attachment_to_a_PDF_document</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.Pdf.NET" Version="20.1.0.61" /> | ||
</ItemGroup> | ||
|
||
</Project> |
1 change: 1 addition & 0 deletions
1
...nt/Adding-attachment-to-a-PDF-document/.NET/Adding-attachment-to-a-PDF-document/Input.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello World!!! |
29 changes: 29 additions & 0 deletions
29
...t/Adding-attachment-to-a-PDF-document/.NET/Adding-attachment-to-a-PDF-document/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
|
||
using Syncfusion.Pdf; | ||
using Syncfusion.Pdf.Interactive; | ||
|
||
//Create a new PDF document. | ||
PdfDocument document = new PdfDocument(); | ||
|
||
//Get stream from an existing PDF document. | ||
Stream fileStream = new FileStream(Path.GetFullPath("../../../Input.txt"), FileMode.Open, FileAccess.Read); | ||
|
||
//Creates an attachment with properties. | ||
PdfAttachment attachment = new PdfAttachment("Input.txt", fileStream); | ||
attachment.ModificationDate = DateTime.Now; | ||
attachment.Description = "Input.txt"; | ||
attachment.MimeType = "application/txt"; | ||
|
||
//Adds the attachment to the document. | ||
document.Attachments.Add(attachment); | ||
|
||
//Create file stream. | ||
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) | ||
{ | ||
//Save the PDF document to file stream. | ||
document.Save(outputFileStream); | ||
} | ||
|
||
//Close the document. | ||
document.Close(true); |
25 changes: 25 additions & 0 deletions
25
...s-to-an-existing-PDF-document/.NET/Adding-the-attachments-to-an-existing-PDF-document.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.1.32407.343 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Adding-the-attachments-to-an-existing-PDF-document", "Adding-the-attachments-to-an-existing-PDF-document\Adding-the-attachments-to-an-existing-PDF-document.csproj", "{700076D0-515D-452C-8A48-1DFC8E4E5EE8}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{700076D0-515D-452C-8A48-1DFC8E4E5EE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{700076D0-515D-452C-8A48-1DFC8E4E5EE8}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{700076D0-515D-452C-8A48-1DFC8E4E5EE8}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{700076D0-515D-452C-8A48-1DFC8E4E5EE8}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {88283A14-1DB2-40F3-A2B0-25DEB81C9713} | ||
EndGlobalSection | ||
EndGlobal |
15 changes: 15 additions & 0 deletions
15
...nts-to-an-existing-PDF-document/Adding-the-attachments-to-an-existing-PDF-document.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<RootNamespace>Adding_the_attachments_to_an_existing_PDF_document</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.Pdf.NET" Version="20.1.0.61" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Binary file added
BIN
+16.7 KB
...n-existing-PDF-document/.NET/Adding-the-attachments-to-an-existing-PDF-document/Input.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions
1
...n-existing-PDF-document/.NET/Adding-the-attachments-to-an-existing-PDF-document/Input.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello World!!! |
36 changes: 36 additions & 0 deletions
36
...-existing-PDF-document/.NET/Adding-the-attachments-to-an-existing-PDF-document/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
|
||
using Syncfusion.Pdf.Interactive; | ||
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 PDF document. | ||
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream); | ||
|
||
//Get stream from the text file. | ||
Stream fileStream = new FileStream(Path.GetFullPath("../../../Input.txt"), FileMode.Open, FileAccess.Read); | ||
|
||
//Creates an attachment. | ||
PdfAttachment attachment = new PdfAttachment("Input.txt", fileStream); | ||
attachment.ModificationDate = DateTime.Now; | ||
attachment.Description = "Input.txt"; | ||
attachment.MimeType = "application/txt"; | ||
|
||
//Create attachment. | ||
if (loadedDocument.Attachments == null) | ||
loadedDocument.CreateAttachment(); | ||
|
||
//Add the attachment to the document. | ||
loadedDocument.Attachments.Add(attachment); | ||
|
||
//Create file stream. | ||
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) | ||
{ | ||
//Save the PDF document to file stream. | ||
loadedDocument.Save(outputFileStream); | ||
} | ||
|
||
//Close the document. | ||
loadedDocument.Close(true); |
25 changes: 25 additions & 0 deletions
25
...nd-saving-an-attachment-to-the-disk/.NET/Extract-and-saving-an-attachment-to-the-disk.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.1.32407.343 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Extract-and-saving-an-attachment-to-the-disk", "Extract-and-saving-an-attachment-to-the-disk\Extract-and-saving-an-attachment-to-the-disk.csproj", "{C4D05435-AB1B-427A-983A-209165254A9B}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{C4D05435-AB1B-427A-983A-209165254A9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{C4D05435-AB1B-427A-983A-209165254A9B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{C4D05435-AB1B-427A-983A-209165254A9B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{C4D05435-AB1B-427A-983A-209165254A9B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {BF66796C-CA28-409C-BB42-942B9FAE96AE} | ||
EndGlobalSection | ||
EndGlobal |
15 changes: 15 additions & 0 deletions
15
...-and-saving-an-attachment-to-the-disk/Extract-and-saving-an-attachment-to-the-disk.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<RootNamespace>Extract_and_saving_an_attachment_to_the_disk</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.Pdf.NET" Version="20.1.0.61" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Binary file added
BIN
+18.4 KB
...ing-an-attachment-to-the-disk/.NET/Extract-and-saving-an-attachment-to-the-disk/Input.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions
1
...ing-an-attachment-to-the-disk/.NET/Extract-and-saving-an-attachment-to-the-disk/Input.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello World!!! |
22 changes: 22 additions & 0 deletions
22
...ng-an-attachment-to-the-disk/.NET/Extract-and-saving-an-attachment-to-the-disk/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
|
||
using Syncfusion.Pdf.Interactive; | ||
using Syncfusion.Pdf.Parsing; | ||
|
||
//Get stream from the existing PDF document. | ||
FileStream docStream = new FileStream(Path.GetFullPath("../../../Input.pdf"), FileMode.Open, FileAccess.Read); | ||
|
||
//Load the PDF document. | ||
PdfLoadedDocument document = new PdfLoadedDocument(docStream); | ||
|
||
//Iterates the attachments. | ||
foreach (PdfAttachment attachment in document.Attachments) | ||
{ | ||
//Extracts the attachment and saves it to the disk. | ||
FileStream s = new FileStream(Path.GetFullPath("../../../"+ attachment.FileName), FileMode.Create); | ||
s.Write(attachment.Data, 0, attachment.Data.Length); | ||
s.Dispose(); | ||
} | ||
|
||
//Close the document. | ||
document.Close(true); |
25 changes: 25 additions & 0 deletions
25
...nt-from-an-existing-PDF-document/.NET/Remove-attachment-from-an-existing-PDF-document.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.1.32407.343 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Remove-attachment-from-an-existing-PDF-document", "Remove-attachment-from-an-existing-PDF-document\Remove-attachment-from-an-existing-PDF-document.csproj", "{34FD36EF-4563-494D-9263-5FB50868116D}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{34FD36EF-4563-494D-9263-5FB50868116D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{34FD36EF-4563-494D-9263-5FB50868116D}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{34FD36EF-4563-494D-9263-5FB50868116D}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{34FD36EF-4563-494D-9263-5FB50868116D}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {2FAE4116-4E4E-429E-8A99-36D22FAF0EF1} | ||
EndGlobalSection | ||
EndGlobal |
Binary file added
BIN
+18.4 KB
...m-an-existing-PDF-document/.NET/Remove-attachment-from-an-existing-PDF-document/Input.pdf
Binary file not shown.
25 changes: 25 additions & 0 deletions
25
...-an-existing-PDF-document/.NET/Remove-attachment-from-an-existing-PDF-document/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
|
||
using Syncfusion.Pdf.Parsing; | ||
|
||
//Get stream from the existing PDF document. | ||
FileStream docStream = new FileStream(Path.GetFullPath("../../../Input.pdf"), FileMode.Open, FileAccess.Read); | ||
|
||
//Load the PDF document. | ||
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream); | ||
|
||
//Removes an attachment. | ||
loadedDocument.Attachments.RemoveAt(0); | ||
|
||
//PdfAttachment attachment = document.Attachments[0]; | ||
//document.Attachments.Remove(attachment); | ||
|
||
//Create file stream. | ||
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) | ||
{ | ||
//Save the PDF document to file stream. | ||
loadedDocument.Save(outputFileStream); | ||
} | ||
|
||
//Close the document. | ||
loadedDocument.Close(true); |
15 changes: 15 additions & 0 deletions
15
...ment-from-an-existing-PDF-document/Remove-attachment-from-an-existing-PDF-document.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<RootNamespace>Remove_attachment_from_an_existing_PDF_document</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.Pdf.NET" Version="20.1.0.61" /> | ||
</ItemGroup> | ||
|
||
</Project> |
25 changes: 25 additions & 0 deletions
25
...ithout-displaying-text/.NET/Add-a-barcode-to-the-PDF-document-without-displaying-text.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.1.32407.343 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Add-a-barcode-to-the-PDF-document-without-displaying-text", "Add-a-barcode-to-the-PDF-document-without-displaying-text\Add-a-barcode-to-the-PDF-document-without-displaying-text.csproj", "{BBB11B62-92CE-4BA8-95D7-E331F726F322}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{BBB11B62-92CE-4BA8-95D7-E331F726F322}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{BBB11B62-92CE-4BA8-95D7-E331F726F322}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{BBB11B62-92CE-4BA8-95D7-E331F726F322}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{BBB11B62-92CE-4BA8-95D7-E331F726F322}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {97341A8D-CC6B-42B7-A462-0EE36DF8AEE2} | ||
EndGlobalSection | ||
EndGlobal |
15 changes: 15 additions & 0 deletions
15
...-without-displaying-text/Add-a-barcode-to-the-PDF-document-without-displaying-text.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<RootNamespace>Add_a_barcode_to_the_PDF_document_without_displaying_text</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.Pdf.NET" Version="20.1.0.61" /> | ||
</ItemGroup> | ||
|
||
</Project> |
38 changes: 38 additions & 0 deletions
38
...displaying-text/.NET/Add-a-barcode-to-the-PDF-document-without-displaying-text/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
|
||
using Syncfusion.Drawing; | ||
using Syncfusion.Pdf; | ||
using Syncfusion.Pdf.Barcode; | ||
|
||
//Creating new PDF Document. | ||
PdfDocument document = new PdfDocument(); | ||
|
||
//Adding a new page to the PDF document. | ||
PdfPage page = document.Pages.Add(); | ||
|
||
//Create a new instance for the Codabar barcode. | ||
PdfCode39Barcode barcode = new PdfCode39Barcode(); | ||
|
||
//Set the barcode location. | ||
barcode.Location = new PointF(10, 10); | ||
|
||
//Set the barcode text. | ||
barcode.Text = "123456789"; | ||
|
||
//Disable the barcode text. | ||
barcode.TextDisplayLocation = TextLocation.None; | ||
|
||
//Printing barcode on to the PDF document. | ||
barcode.Draw(page); | ||
|
||
//Create file stream. | ||
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output.pdf"), FileMode.Create, FileAccess.ReadWrite)) | ||
{ | ||
//Save the PDF document to file stream. | ||
document.Save(outputFileStream); | ||
} | ||
|
||
//Close the document. | ||
document.Close(true); | ||
|
||
|
Oops, something went wrong.