Skip to content

Commit

Permalink
Merge pull request #61 from SyncfusionExamples/862721-vol4-sample
Browse files Browse the repository at this point in the history
862721 -Added the Split PDF samples for Vol4 features
  • Loading branch information
chinnumuniyappan authored Dec 20, 2023
2 parents a2fff59 + 69d3faa commit 44b31b1
Show file tree
Hide file tree
Showing 8 changed files with 143 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.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
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 not shown.
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);
}
}
}
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 not shown.
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);
}
}
}
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>

0 comments on commit 44b31b1

Please sign in to comment.