-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from SyncfusionExamples/862721-vol4-sample
862721 -Added the Split PDF samples for Vol4 features
- Loading branch information
Showing
8 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
...hen-splitting-PDF-documents/.NET/Import-tagged-structure-when-splitting-PDF-documents.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.9.34321.82 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Import-tagged-structure-when-splitting-PDF-documents", "Import-tagged-structure-when-splitting-PDF-documents\Import-tagged-structure-when-splitting-PDF-documents.csproj", "{8DB2047A-F9D0-44CE-9B60-AAF8C9D5FE01}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{8DB2047A-F9D0-44CE-9B60-AAF8C9D5FE01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{8DB2047A-F9D0-44CE-9B60-AAF8C9D5FE01}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{8DB2047A-F9D0-44CE-9B60-AAF8C9D5FE01}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{8DB2047A-F9D0-44CE-9B60-AAF8C9D5FE01}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {1F0BA3A5-3B80-46C3-BBB0-406519E87163} | ||
EndGlobalSection | ||
EndGlobal |
15 changes: 15 additions & 0 deletions
15
...-when-splitting-PDF-documents/Import-tagged-structure-when-splitting-PDF-documents.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>net8.0</TargetFramework> | ||
<RootNamespace>Import_tagged_structure_when_splitting_PDF_documents</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="24.1.41" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Binary file added
BIN
+122 KB
...litting-PDF-documents/.NET/Import-tagged-structure-when-splitting-PDF-documents/Input.pdf
Binary file not shown.
32 changes: 32 additions & 0 deletions
32
...itting-PDF-documents/.NET/Import-tagged-structure-when-splitting-PDF-documents/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,32 @@ | ||
using Syncfusion.Pdf.Parsing; | ||
using Syncfusion.Pdf; | ||
|
||
namespace Import_tagged_structure_when_splitting_PDF_documents | ||
{ | ||
internal class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
//Load an existing PDF file. | ||
PdfLoadedDocument loadDocument = new PdfLoadedDocument(new FileStream("../../../Input.pdf", FileMode.Open)); | ||
//Subscribe to the document split event. | ||
loadDocument.DocumentSplitEvent += LoadDocument_DocumentSplitEvent; | ||
void LoadDocument_DocumentSplitEvent(object sender, PdfDocumentSplitEventArgs args) | ||
{ | ||
//Save the resulting document. | ||
FileStream outputStream = new FileStream(Guid.NewGuid().ToString() + ".pdf", FileMode.CreateNew); | ||
args.PdfDocumentData.CopyTo(outputStream); | ||
outputStream.Close(); | ||
} | ||
//Create the split options object. | ||
PdfSplitOptions splitOptions = new PdfSplitOptions(); | ||
//Enable the Split tags property. | ||
splitOptions.SplitTags = true; | ||
//Split the document by ranges. | ||
loadDocument.SplitByRanges(new int[,] { { 0, 1 }, { 1, 2 } }, splitOptions); | ||
|
||
//Close the document. | ||
loadDocument.Close(true); | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...hen-Splitting-PDF-Documents/.NET/Remove-Unused-Resources-when-Splitting-PDF-Documents.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.9.34321.82 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Remove-Unused-Resources-when-Splitting-PDF-Documents", "Remove-Unused-Resources-when-Splitting-PDF-Documents\Remove-Unused-Resources-when-Splitting-PDF-Documents.csproj", "{F43A3B93-60B8-4CFC-A81B-6626FF2ECDB3}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{F43A3B93-60B8-4CFC-A81B-6626FF2ECDB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{F43A3B93-60B8-4CFC-A81B-6626FF2ECDB3}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{F43A3B93-60B8-4CFC-A81B-6626FF2ECDB3}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{F43A3B93-60B8-4CFC-A81B-6626FF2ECDB3}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {5B142F7A-8FE8-432C-BE64-70FFC605ADA6} | ||
EndGlobalSection | ||
EndGlobal |
Binary file added
BIN
+34.2 MB
...litting-PDF-Documents/.NET/Remove-Unused-Resources-when-Splitting-PDF-Documents/Input.pdf
Binary file not shown.
31 changes: 31 additions & 0 deletions
31
...itting-PDF-Documents/.NET/Remove-Unused-Resources-when-Splitting-PDF-Documents/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,31 @@ | ||
using Syncfusion.Pdf; | ||
using Syncfusion.Pdf.Parsing; | ||
|
||
namespace Remove_Unused_Resources_when_Splitting_PDF_Documents | ||
{ | ||
internal class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
//Load the existing PDF file. | ||
PdfLoadedDocument loadDocument = new PdfLoadedDocument(new FileStream("../../../Input.pdf", FileMode.Open)); | ||
//Subscribe to the document split event. | ||
loadDocument.DocumentSplitEvent += LoadDocument_DocumentSplitEvent; | ||
void LoadDocument_DocumentSplitEvent(object sender, PdfDocumentSplitEventArgs args) | ||
{ | ||
//Save the resulting document. | ||
FileStream outputStream = new FileStream(Guid.NewGuid().ToString() + ".pdf", FileMode.CreateNew); | ||
args.PdfDocumentData.CopyTo(outputStream); | ||
outputStream.Close(); | ||
} | ||
//Create the split options object. | ||
PdfSplitOptions splitOptions = new PdfSplitOptions(); | ||
//Enable the removal of unused resources property. | ||
splitOptions.RemoveUnusedResources = true; | ||
//Split the document by ranges. | ||
loadDocument.SplitByRanges(new int[,] { { 0, 5 }, { 5, 10 } }, splitOptions); | ||
//Close the document. | ||
loadDocument.Close(true); | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...-when-Splitting-PDF-Documents/Remove-Unused-Resources-when-Splitting-PDF-Documents.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>net8.0</TargetFramework> | ||
<RootNamespace>Remove_Unused_Resources_when_Splitting_PDF_Documents</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="24.1.41" /> | ||
</ItemGroup> | ||
|
||
</Project> |