Now, let us look at my blog. The different categories in the right column split the whole blog articles into multiple posts of various kinds, which is very convenient. That is why we split one PDF Document to multiple files.
This task needs a document of at least two pages. I use a PDF creation component Spire.PDF for .NET which contains a PDF Document of eight pages and can split PDF document with a fast speed.
Freely Download Spire.PDF
Step1. Load the PDF Document “Sample3.pdf” from Spire.PDF in the system.
Step2. Split the PDF Document to multiple files. In the code, I split the eight pages’ PDF Document to eight PDF files.
Step3. Launch the project and see the eight PDF files.
Main Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Spire.Pdf;
namespace split_pdf
{
class Program
{
static void Main(string[] args)
{
//open pdf document
PdfDocument doc = new PdfDocument(@"C:\Program
Files\e-iceblue\Spire.Pdf\Demos\Data\Sample3.pdf");
//Split the PDF Document
String pattern = "SplitDocument-{0}.pdf"; doc.Split(pattern);
String lastPageFileName = String.Format(pattern, doc.Pages.Count - 1);
doc.Close();
//Launching the Pdf file.
System.Diagnostics.Process.Start(lastPageFileName);
}
}
}
Imports System;
Imports System.Collections.Generic;
Imports System.Linq;
Imports System.Text;
Imports Spire.Pdf;
Namespace split_pdf
Friend Class Program
Shared Sub Main(ByVal args() As String)
'open pdf document
Dim doc As New PdfDocument("C:\Program
Files\e-iceblue\Spire.Pdf\Demos\Data\Sample3.pdf")
‘Split the PDF Document
Dim pattern As String = "SplitDocument-{0}.pdf"doc.Split(pattern)
Dim lastPageFileName As String = String.Format(pattern, doc.Pages.Count - 1)
doc.Close()
'Launching the Pdf file.
Process.Start(lastPageFileName)
End Sub
End Class
End Namespace
below PDF forum.
PDF Forum