Skip to content

Commit cbc9b73

Browse files
Merge pull request #8 from SyncfusionExamples/WF-63148-Update-PDF-samples-in-GitHub-Master
WF-63148 - Added the sample in GitHub - Master
2 parents 352c224 + 55b53f5 commit cbc9b73

File tree

47 files changed

+467
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+467
-0
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 17
4+
VisualStudioVersion = 17.3.32819.101
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Adding-XMP-metadata-along-with-an-image-in-PDF", "Adding-XMP-metadata-along-with-an-image-in-PDF\Adding-XMP-metadata-along-with-an-image-in-PDF.csproj", "{23B9CBFB-CF05-43FA-9983-3A95E3FEDFBA}"
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+
{23B9CBFB-CF05-43FA-9983-3A95E3FEDFBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{23B9CBFB-CF05-43FA-9983-3A95E3FEDFBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{23B9CBFB-CF05-43FA-9983-3A95E3FEDFBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{23B9CBFB-CF05-43FA-9983-3A95E3FEDFBA}.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 = {2D7C8A2F-88A5-4BD2-B5CD-19F81C61F4CD}
24+
EndGlobalSection
25+
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>net6.0</TargetFramework>
6+
<RootNamespace>Adding_XMP_metadata_along_with_an_image_in_PDF</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Pdf.NET" Version="20.2.0.49" />
13+
</ItemGroup>
14+
15+
</Project>
102 KB
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// See https://aka.ms/new-console-template for more information
2+
3+
using Syncfusion.Pdf.Graphics;
4+
using Syncfusion.Pdf;
5+
using System.Reflection.Metadata;
6+
7+
//Create a new PDF document.
8+
PdfDocument document = new PdfDocument();
9+
10+
//Add a page to the document.
11+
PdfPage page = document.Pages.Add();
12+
13+
//Create PDF graphics for the page.
14+
PdfGraphics graphics = page.Graphics;
15+
16+
//Load the image as stream which contains XMP metadata.
17+
FileStream imageStream = new FileStream(Path.GetFullPath("../../../Autumn Leaves.jpg"), FileMode.Open, FileAccess.Read);
18+
PdfBitmap image = new PdfBitmap(imageStream, true);
19+
20+
//Draw the image.
21+
graphics.DrawImage(image, 0, 0);
22+
23+
//Create file stream.
24+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
25+
{
26+
//Save the PDF document to file stream.
27+
document.Save(outputFileStream);
28+
}
29+
30+
//Close the document.
31+
document.Close(true);
32+
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 17
4+
VisualStudioVersion = 17.3.32819.101
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Extracting-XMP-metadata-from-PDF-image", "Extracting-XMP-metadata-from-PDF-image\Extracting-XMP-metadata-from-PDF-image.csproj", "{ED3E8F7A-2138-47EE-915C-3FE573D1B2EC}"
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+
{ED3E8F7A-2138-47EE-915C-3FE573D1B2EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{ED3E8F7A-2138-47EE-915C-3FE573D1B2EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{ED3E8F7A-2138-47EE-915C-3FE573D1B2EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{ED3E8F7A-2138-47EE-915C-3FE573D1B2EC}.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 = {D9CFCCE9-C0E2-45A4-AF42-0851B4C38392}
24+
EndGlobalSection
25+
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>net6.0</TargetFramework>
6+
<RootNamespace>Extracting_XMP_metadata_from_PDF_image</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Pdf.Imaging.Net.Core" Version="20.2.0.49" />
13+
</ItemGroup>
14+
15+
</Project>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// See https://aka.ms/new-console-template for more information
2+
3+
using Syncfusion.Pdf.Parsing;
4+
using Syncfusion.Pdf.Xmp;
5+
using Syncfusion.Pdf;
6+
using Syncfusion.Pdf.Exporting;
7+
8+
//Get stream from an existing PDF document.
9+
FileStream docStream = new FileStream(Path.GetFullPath("../../../Input.pdf"), FileMode.Open, FileAccess.Read);
10+
11+
//Load the PDF document.
12+
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
13+
14+
//Load the first page.
15+
PdfPageBase pageBase = loadedDocument.Pages[0];
16+
17+
//Extracts all the images info from first page.
18+
PdfImageInfo[] imagesInfo = pageBase.GetImagesInfo();
19+
20+
//Extracts the XMP metadata from PDF image.
21+
XmpMetadata metadata = imagesInfo[0].Metadata;
22+
23+
//Close the document.
24+
loadedDocument.Close(true);
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 15
4+
VisualStudioVersion = 15.0.28307.1000
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Create-a-PDFX1A-conformance-document", "Create-a-PDFX1A-conformance-document\Create-a-PDFX1A-conformance-document.csproj", "{1C7A4B0E-43C5-44D1-A6E2-E011ECE4D881}"
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+
{1C7A4B0E-43C5-44D1-A6E2-E011ECE4D881}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{1C7A4B0E-43C5-44D1-A6E2-E011ECE4D881}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{1C7A4B0E-43C5-44D1-A6E2-E011ECE4D881}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{1C7A4B0E-43C5-44D1-A6E2-E011ECE4D881}.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 = {E6E22176-89CD-413C-9965-9216F8BB582E}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
5+
</startup>
6+
</configuration>

0 commit comments

Comments
 (0)