Skip to content

Commit

Permalink
Committed the samples for ColorSpace, JavaScript, PDF Conformance, Re…
Browse files Browse the repository at this point in the history
…daction and ZUGFeRD
  • Loading branch information
SowmiyaLoganathan committed Aug 9, 2022
1 parent 0fac1f3 commit b3f506d
Show file tree
Hide file tree
Showing 230 changed files with 4,692 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.1.32407.343
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Add-color-space-in-particular-object-in-an-existing-PDF", "Add-color-space-in-particular-object-in-an-existing-PDF\Add-color-space-in-particular-object-in-an-existing-PDF.csproj", "{D2B07CBA-5E2F-46AD-93BB-89D61F4C58CB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D2B07CBA-5E2F-46AD-93BB-89D61F4C58CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2B07CBA-5E2F-46AD-93BB-89D61F4C58CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2B07CBA-5E2F-46AD-93BB-89D61F4C58CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2B07CBA-5E2F-46AD-93BB-89D61F4C58CB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F4C9ED1A-FCBF-4297-967D-5E932D9A93B8}
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>net6.0</TargetFramework>
<RootNamespace>Add_color_space_in_particular_object_in_an_existing_PDF</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

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

</Project>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// See https://aka.ms/new-console-template for more information

using Syncfusion.Drawing;
using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Parsing;

//Get stream from an existing PDF document.
FileStream docStream = new FileStream("../../../Input.pdf", FileMode.Open, FileAccess.Read);

//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);

//Loads the page.
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;

//Acquires graphics of the page.
PdfGraphics graphics = loadedPage.Graphics;

//Set the pen.
PdfPen pen = new PdfPen(Color.Red);

//Set the brush.
PdfBrush brush = new PdfSolidBrush(Color.Blue);

//Set the bounds.
RectangleF rectangle = new RectangleF(0, 0, 100, 100);

//Default color space.
graphics.DrawRectangle(pen, brush, rectangle);
graphics.Save();

//GrayScale color space.
graphics.ColorSpace = PdfColorSpace.GrayScale;
graphics.DrawRectangle(pen, brush, rectangle);

//CMYK color space.
graphics.ColorSpace = PdfColorSpace.CMYK;

//Draw rectangle.
graphics.DrawRectangle(pen, brush, rectangle);
graphics.Restore();

//Default color space.
graphics.DrawRectangle(pen, brush, rectangle);

//Draws by using the PdfBrush.
graphics.DrawRectangle(brush, rectangle);

//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);
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-graphics-elemets-by-Pantone-color-in-existing-PDF", "Add-graphics-elemets-by-Pantone-color-in-existing-PDF\Add-graphics-elemets-by-Pantone-color-in-existing-PDF.csproj", "{FCDEA0A0-1AA9-4DF5-A3F3-131992CA6445}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FCDEA0A0-1AA9-4DF5-A3F3-131992CA6445}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FCDEA0A0-1AA9-4DF5-A3F3-131992CA6445}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FCDEA0A0-1AA9-4DF5-A3F3-131992CA6445}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FCDEA0A0-1AA9-4DF5-A3F3-131992CA6445}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A9F35406-99D6-4773-B776-538A4871C69B}
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>net6.0</TargetFramework>
<RootNamespace>Add_graphics_elemets_by_Pantone_color_in_existing_PDF</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

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

</Project>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// See https://aka.ms/new-console-template for more information

using Syncfusion.Drawing;
using Syncfusion.Pdf;
using Syncfusion.Pdf.ColorSpace;
using Syncfusion.Pdf.Functions;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Parsing;

//Get stream from an existing PDF document.
FileStream docStream = new FileStream("../../../Input.pdf", FileMode.Open, FileAccess.Read);

//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);

//Load the page.
PdfLoadedPage loadedPage = loadedDocument.Pages[0] as PdfLoadedPage;

//Creates exponential interpolation function.
PdfExponentialInterpolationFunction function = new PdfExponentialInterpolationFunction(true);
float[] numberArray = new float[4];
numberArray[0] = 0.38f;
numberArray[1] = 0.88f;
function.C1 = numberArray;

//Creates SeparationColorSpace.
PdfSeparationColorSpace colorSpace = new PdfSeparationColorSpace();
colorSpace.TintTransform = function;
colorSpace.Colorant = "PANTONE Orange 021 C";

//Creates SeparationColorSpace.
PdfSeparationColor color = new PdfSeparationColor(colorSpace);
color.Tint = 0.7;

//Set bounds and pen.
RectangleF bounds = new RectangleF(20, 70, 200, 100);
PdfPen pen = new PdfPen(color);

//Draws the rectangle.
loadedPage.Graphics.DrawRectangle(pen, bounds);

//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);
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}") = "Create-PDF-document-with-ICC-color-space", "Create-PDF-document-with-ICC-color-space\Create-PDF-document-with-ICC-color-space.csproj", "{94B4858D-D979-4400-A5CD-74327FE2142E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{94B4858D-D979-4400-A5CD-74327FE2142E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94B4858D-D979-4400-A5CD-74327FE2142E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{94B4858D-D979-4400-A5CD-74327FE2142E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94B4858D-D979-4400-A5CD-74327FE2142E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DE843F3B-BCDC-4FD2-9015-2A4C419A17D0}
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>net6.0</TargetFramework>
<RootNamespace>Create_PDF_document_with_ICC_color_space</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

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

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// See https://aka.ms/new-console-template for more information

using Syncfusion.Drawing;
using Syncfusion.Pdf;
using Syncfusion.Pdf.ColorSpace;
using Syncfusion.Pdf.Graphics;

//Creates a new PDF document.
PdfDocument pdfDocument = new PdfDocument();

//Adds a page to the PDF document.
PdfPage pdfPage = pdfDocument.Pages.Add();

//Acquires graphics of the page.
PdfGraphics graphics = pdfPage.Graphics;

//Creates ICCBased color space.
PdfCalRGBColorSpace calRgbCS = new PdfCalRGBColorSpace();
calRgbCS.Gamma = new double[] { 7.6, 5.1, 8.5 };
calRgbCS.Matrix = new double[] { 1, 0, 0, 0, 1, 0, 0, 0, 1 };
calRgbCS.WhitePoint = new double[] { 0.7, 1, 0.8 };

//Reads the ICC profile.
FileStream fileStream = new FileStream(Path.GetFullPath(@"../../../input.icc"), FileMode.Open, FileAccess.Read);
byte[] profileData = new byte[fileStream.Length];
fileStream.Read(profileData, 0, profileData.Length);
fileStream.Close();

//Instantiates ICC color space.
PdfICCColorSpace iccBasedCS = new PdfICCColorSpace();
iccBasedCS.ProfileData = profileData;
iccBasedCS.AlternateColorSpace = calRgbCS;
iccBasedCS.ColorComponents = 3;
iccBasedCS.Range = new double[] { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 };

//Create ICC color.
PdfICCColor red = new PdfICCColor(iccBasedCS);
red.ColorComponents = new double[] { 1, 0, 1 };

//Set the brush.
PdfBrush brush = new PdfSolidBrush(red);

//Set the bounds.
RectangleF bounds = new RectangleF(0, 0, 300, 300);

//Draws rectangle by using the PdfBrush.
graphics.DrawRectangle(brush, bounds);

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

//Close the document.
pdfDocument.Close(true);
Binary file not shown.
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}") = "Draw-graphics-elements-by-using-Pantone-colors-in-a-PDF", "Draw-graphics-elements-by-using-Pantone-colors-in-a-PDF\Draw-graphics-elements-by-using-Pantone-colors-in-a-PDF.csproj", "{7432B2A3-3916-4E0F-A059-64A2BDD056AC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7432B2A3-3916-4E0F-A059-64A2BDD056AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7432B2A3-3916-4E0F-A059-64A2BDD056AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7432B2A3-3916-4E0F-A059-64A2BDD056AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7432B2A3-3916-4E0F-A059-64A2BDD056AC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F58591AB-B686-4444-8583-A4DB98EF8A3B}
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>net6.0</TargetFramework>
<RootNamespace>Draw_graphics_elements_by_using_Pantone_colors_in_a_PDF</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

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

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// See https://aka.ms/new-console-template for more information

using Syncfusion.Drawing;
using Syncfusion.Pdf;
using Syncfusion.Pdf.ColorSpace;
using Syncfusion.Pdf.Functions;
using Syncfusion.Pdf.Graphics;

//Creates a new document.
PdfDocument document = new PdfDocument();

//Creates a new page.
PdfPage page = document.Pages.Add();

//Creates exponential interpolation function.
PdfExponentialInterpolationFunction function = new PdfExponentialInterpolationFunction(true);
float[] numberArray = new float[4];
numberArray[0] = 0.38f;
numberArray[1] = 0.88f;
function.C1 = numberArray;

//Creates SeparationColorSpace.
PdfSeparationColorSpace colorSpace = new PdfSeparationColorSpace();
colorSpace.TintTransform = function;
colorSpace.Colorant = "PANTONE Orange 021 C";

//Creates SeparationColorSpace.
PdfSeparationColor color = new PdfSeparationColor(colorSpace);
color.Tint = 0.7;

//Set bounds and pen.
RectangleF bounds = new RectangleF(20, 70, 200, 100);
PdfPen pen = new PdfPen(color);

//Draws the rectangle.
page.Graphics.DrawRectangle(pen, bounds);

//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);
Loading

0 comments on commit b3f506d

Please sign in to comment.