Skip to content

Commit e961557

Browse files
WF-63149 Update sample for working with document
1 parent 8f87a35 commit e961557

File tree

72 files changed

+1693
-2
lines changed

Some content is hidden

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

72 files changed

+1693
-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 17
4+
VisualStudioVersion = 17.1.32407.343
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Add_BaseUri_in_the_PDF_document", "Add_BaseUri_in_the_PDF_document\Add_BaseUri_in_the_PDF_document.csproj", "{B027B9B2-4DBB-4DDA-97E7-1BDE942A0911}"
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+
{B027B9B2-4DBB-4DDA-97E7-1BDE942A0911}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{B027B9B2-4DBB-4DDA-97E7-1BDE942A0911}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{B027B9B2-4DBB-4DDA-97E7-1BDE942A0911}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{B027B9B2-4DBB-4DDA-97E7-1BDE942A0911}.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 = {21E935CC-6F39-4988-BC44-1E33EB9FF54A}
24+
EndGlobalSection
25+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net6.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Syncfusion.Pdf.NET" Version="20.1.0.50" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// See https://aka.ms/new-console-template for more information
2+
3+
using Syncfusion.Pdf;
4+
5+
//Create a new instance of the PdfDocument class.
6+
PdfDocument document = new PdfDocument();
7+
8+
//Set the Base URI.
9+
document.BaseUri = "https://www.syncfusion.com/";
10+
11+
//Create a new page.
12+
PdfPage page = document.Pages.Add();
13+
14+
//Create file stream.
15+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
16+
{
17+
//Save the PDF document to file stream.
18+
document.Save(outputFileStream);
19+
}
20+
21+
//Close the document.
22+
document.Close(true);
23+
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.1.32407.343
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Add_PDF_document_properties", "Add_PDF_document_properties\Add_PDF_document_properties.csproj", "{B858A7F3-45D6-433C-BEB7-EE6E68FBC961}"
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+
{B858A7F3-45D6-433C-BEB7-EE6E68FBC961}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{B858A7F3-45D6-433C-BEB7-EE6E68FBC961}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{B858A7F3-45D6-433C-BEB7-EE6E68FBC961}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{B858A7F3-45D6-433C-BEB7-EE6E68FBC961}.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 = {BE8AB7B4-9FD9-4015-8E23-F898944F3537}
24+
EndGlobalSection
25+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net6.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Syncfusion.Pdf.NET" Version="20.1.0.50" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// See https://aka.ms/new-console-template for more information
2+
3+
using Syncfusion.Drawing;
4+
using Syncfusion.Pdf;
5+
using Syncfusion.Pdf.Graphics;
6+
7+
//Create a new PDF document.
8+
PdfDocument document = new PdfDocument();
9+
10+
//Set document information.
11+
document.DocumentInformation.Author = "Syncfusion";
12+
document.DocumentInformation.CreationDate = DateTime.Now;
13+
document.DocumentInformation.Creator = "Essential PDF";
14+
document.DocumentInformation.Keywords = "PDF";
15+
document.DocumentInformation.Subject = "Document information DEMO";
16+
document.DocumentInformation.Title = "Essential PDF Sample";
17+
18+
//Add a page to the document.
19+
PdfPage page = document.Pages.Add();
20+
21+
//Create PDF graphics for the page.
22+
PdfGraphics graphics = page.Graphics;
23+
24+
//Set the font.
25+
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
26+
27+
//Draw text to the page.
28+
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new PointF(0, 0));
29+
30+
//Save the document.
31+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
32+
{
33+
document.Save(outputFileStream);
34+
}
35+
36+
//Close the document.
37+
document.Close(true);
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.1.32407.343
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Change-the-page-orientation-from-portrait-to-landscape", "Change-the-page-orientation-from-portrait-to-landscape\Change-the-page-orientation-from-portrait-to-landscape.csproj", "{A2C30CB6-DF26-43BA-B648-8F009D73AD23}"
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+
{A2C30CB6-DF26-43BA-B648-8F009D73AD23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{A2C30CB6-DF26-43BA-B648-8F009D73AD23}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{A2C30CB6-DF26-43BA-B648-8F009D73AD23}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{A2C30CB6-DF26-43BA-B648-8F009D73AD23}.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 = {B16181A6-6594-48A5-881A-2A370D34FA5A}
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>Change_the_page_orientation_from_portrait_to_landscape</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Pdf.NET" Version="20.2.0.36" />
13+
</ItemGroup>
14+
15+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// See https://aka.ms/new-console-template for more information
2+
3+
using Syncfusion.Pdf;
4+
using Syncfusion.Pdf.Graphics;
5+
6+
//Create a new PDF document.
7+
PdfDocument document = new PdfDocument();
8+
9+
//Set the page size.
10+
document.PageSettings.Size = PdfPageSize.A4;
11+
12+
//Change the page orientation to landscape.
13+
document.PageSettings.Orientation = PdfPageOrientation.Landscape;
14+
15+
//Add a page to the document.
16+
PdfPage page = document.Pages.Add();
17+
18+
//Create PDF graphics for the page.
19+
PdfGraphics graphics = page.Graphics;
20+
21+
//Set the font.
22+
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
23+
24+
//Draw the text in PDF page.
25+
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
26+
27+
//Create file stream for output PDF document.
28+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
29+
{
30+
//Save the PDF document to file stream.
31+
document.Save(outputFileStream);
32+
}
33+
34+
//Close the document.
35+
document.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 Version 17
4+
VisualStudioVersion = 17.1.32407.343
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Change_existing_PDF_properties", "Change_existing_PDF_properties\Change_existing_PDF_properties.csproj", "{30B4429C-B570-4796-886E-417316265204}"
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+
{30B4429C-B570-4796-886E-417316265204}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{30B4429C-B570-4796-886E-417316265204}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{30B4429C-B570-4796-886E-417316265204}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{30B4429C-B570-4796-886E-417316265204}.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 = {E12FAAD4-12F7-4DBA-89AA-58C97B38CD2B}
24+
EndGlobalSection
25+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net6.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Syncfusion.Pdf.NET" Version="20.1.0.50" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// See https://aka.ms/new-console-template for more information
2+
3+
using Syncfusion.Pdf.Parsing;
4+
5+
//Get stream from an existing PDF document.
6+
FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"../../../Input.pdf"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
7+
8+
//Load the PDF document.
9+
PdfLoadedDocument document = new PdfLoadedDocument(fileStreamPath);
10+
11+
//Modify the document information.
12+
document.DocumentInformation.Author = "Syncfusion";
13+
document.DocumentInformation.CreationDate = DateTime.Now;
14+
document.DocumentInformation.Creator = "Essential PDF";
15+
document.DocumentInformation.Keywords = "PDF";
16+
document.DocumentInformation.Subject = "Document information DEMO";
17+
document.DocumentInformation.Title = "Essential PDF Sample";
18+
document.DocumentInformation.ModificationDate = DateTime.Now;
19+
document.DocumentInformation.Producer = "Syncfusion PDF";
20+
21+
//Create file stream.
22+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
23+
{
24+
//Save the PDF document.
25+
document.Save(outputFileStream);
26+
}
27+
28+
//Closes the PDF document
29+
document.Close(true);
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.1.32407.343
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Create-PDF-with-display-of-specific-panel", "Create-PDF-with-display-of-specific-panel\Create-PDF-with-display-of-specific-panel.csproj", "{6265E0D0-3746-4BDE-B01F-E9B87F38DB44}"
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+
{6265E0D0-3746-4BDE-B01F-E9B87F38DB44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{6265E0D0-3746-4BDE-B01F-E9B87F38DB44}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{6265E0D0-3746-4BDE-B01F-E9B87F38DB44}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{6265E0D0-3746-4BDE-B01F-E9B87F38DB44}.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 = {6B7F6381-9AE3-4077-9BB7-118C710D74F0}
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>Create_PDF_with_display_of_specific_panel</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Pdf.NET" Version="20.2.0.36" />
13+
</ItemGroup>
14+
15+
</Project>
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;
4+
using Syncfusion.Pdf.Graphics;
5+
6+
//Create a new PDF document.
7+
PdfDocument document = new PdfDocument();
8+
9+
//Add a page to the document.
10+
PdfPage page = document.Pages.Add();
11+
12+
//Create PDF graphics for the page.
13+
PdfGraphics graphics = page.Graphics;
14+
15+
//Set the font.
16+
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
17+
18+
//Draw the text.
19+
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new Syncfusion.Drawing.PointF(0, 0));
20+
21+
//Show the attachments panel.
22+
document.ViewerPreferences.PageMode = PdfPageMode.UseAttachments;
23+
24+
//Create file stream.
25+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
26+
{
27+
//Save the PDF document to file stream.
28+
document.Save(outputFileStream);
29+
}
30+
31+
//Close the document.
32+
document.Close(true);
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.1.32407.343
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Create-a-PDF-document-with-custom-page-size", "Create-a-PDF-document-with-custom-page-size\Create-a-PDF-document-with-custom-page-size.csproj", "{2B8F4238-8965-4318-BADF-ED73273A33B6}"
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+
{2B8F4238-8965-4318-BADF-ED73273A33B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{2B8F4238-8965-4318-BADF-ED73273A33B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{2B8F4238-8965-4318-BADF-ED73273A33B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{2B8F4238-8965-4318-BADF-ED73273A33B6}.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 = {5CF83D2A-7E85-4146-A893-EFDE822C6C2F}
24+
EndGlobalSection
25+
EndGlobal

0 commit comments

Comments
 (0)