Skip to content

Commit 01385c8

Browse files
Merge pull request #1729 from Syncfusion-Content/hotfix/hotfix-v24.1.41
DOCINFRA-2341_merged_using_automation
2 parents 48c1199 + d1b1063 commit 01385c8

File tree

1 file changed

+78
-2
lines changed

1 file changed

+78
-2
lines changed

File-Formats/PDF/Split-Documents.md

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
352352
'Set an output path.
353353
Const destinationFilePattern As String = "Output" + "{0}.pdf"
354354
'Create the split options object.
355-
Dim splitOptions As New PdfSplitOptions();
355+
Dim splitOptions As New PdfSplitOptions()
356356
'Enable the removal of unused resources property.
357357
splitOptions.RemoveUnusedResources = True
358358
'Split the document by ranges.
@@ -365,4 +365,80 @@ loadedDocument.Close(True)
365365

366366
{% endtabs %}
367367

368-
Download a complete working sample from GitHub.
368+
369+
Download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Split%20PDFs/Remove-Unused-Resources-when-Splitting-PDF-Documents/.NET).
370+
371+
## Import Tagged structure when Splitting PDF Documents
372+
373+
The Syncfusion PDF library enables the splitting of PDF documents and offers the capability to import tagged structure during the process. By enabling the `SplitTags` property on the `PdfSplitOptions` class, thereby tagged structure will be imported into the final PDF document. The default value for this property is false.
374+
375+
{% tabs %}
376+
377+
{% highlight c# tabtitle="C# [Cross-platform]" %}
378+
379+
//Load an existing PDF file.
380+
PdfLoadedDocument loadDocument = new PdfLoadedDocument(new FileStream("Input.pdf", FileMode.Open));
381+
//Subscribe to the document split event.
382+
loadDocument.DocumentSplitEvent += LoadDocument_DocumentSplitEvent;
383+
void LoadDocument_DocumentSplitEvent(object sender, PdfDocumentSplitEventArgs args)
384+
{
385+
//Save the resulting document.
386+
FileStream outputStream = new FileStream(Guid.NewGuid().ToString() + ".pdf", FileMode.CreateNew);
387+
args.PdfDocumentData.CopyTo(outputStream);
388+
outputStream.Close();
389+
}
390+
//Create the split options object.
391+
PdfSplitOptions splitOptions = new PdfSplitOptions();
392+
//Enable the Split tags property.
393+
splitOptions.SplitTags = true;
394+
//Split the document by ranges.
395+
loadDocument.SplitByRanges(new int[,] { { 0, 1 }, { 1, 2 } }, splitOptions);
396+
397+
//Close the document.
398+
loadDocument.Close(true);
399+
400+
{% endhighlight %}
401+
402+
{% highlight c# tabtitle="C# [Windows-specific]" %}
403+
404+
//Create the values.
405+
int[,] values = new int[,] { { 0, 1 }, { 1, 2 } };
406+
//Load the PDF document.
407+
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("Input.pdf");
408+
//Set an output file pattern.
409+
const string destinationFilePattern = "Output{0}.pdf";
410+
//Create the split options object.
411+
PdfSplitOptions splitOptions = new PdfSplitOptions();
412+
//Enable the Split tags property.
413+
splitOptions.SplitTags = true;
414+
//Split the document by ranges.
415+
loadedDocument.SplitByRanges(destinationFilePattern, values, splitOptions);
416+
417+
//Close the document.
418+
loadedDocument.Close(true);
419+
420+
{% endhighlight %}
421+
422+
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
423+
424+
'Create the values.
425+
Dim values As Integer(,) = New Integer(,) {{0, 1},{1, 2}}
426+
'Load the PDF document.
427+
Dim loadedDocument As New PdfLoadedDocument("Input.pdf")
428+
'Set an output path.
429+
Const destinationFilePattern As String = "Output" + "{0}.pdf"
430+
'Create the split options object.
431+
Dim splitOptions As New PdfSplitOptions()
432+
'Enable the Split tags property.
433+
splitOptions.SplitTags = True
434+
'Split the document by ranges.
435+
loadedDocument.SplitByRanges(destinationFilePattern, values, splitOptions)
436+
437+
'Close the document.
438+
loadedDocument.Close(True)
439+
440+
{% endhighlight %}
441+
442+
{% endtabs %}
443+
444+
Download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Split%20PDFs/Import-tagged-structure-when-splitting-PDF-documents/.NET).

0 commit comments

Comments
 (0)