Hello,
When splitting a multi page pdf into single pages, the output file size is very large.
The source input file is about 1.6MB, about 58 pages.
Each output file is about 1.5MB per page.
The source file also contains a few blank pages, which are also output with a filesize of about 1.5MB.
I am using PDFSharp v1.32.2608.0.
I have compiled your code as a release build.
I have also downloaded just the assembly.
I have tried both GDI and WPF.
I am not seeing a difference in file size between debug and release. When compiled as debug, I did see verbose in the pdf header using notepad. Verbose is not there using release.
Code:
Imports System.IO
Imports PdfSharp
Imports PdfSharp.Pdf
Imports PdfSharp.Pdf.IO
Private Sub TestPDF()
Dim sFilename As String = "d:\testdoc.pdf"
Dim inputDocument As PdfDocument
inputDocument = PdfReader.Open(sFilename, PdfDocumentOpenMode.Import)
Dim sNameOnly As String = Path.GetFileNameWithoutExtension(sFilename)
Dim i As Integer = 0
For i = 0 To 1 'inputDocument.PageCount
Dim outputDocument As New PdfDocument
outputDocument.Version = inputDocument.Version
outputDocument.Info.Title = String.Format("Page {0} of {1}", i, inputDocument.Info.Title)
outputDocument.Info.Creator = inputDocument.Info.Creator
outputDocument.AddPage(inputDocument.Pages(i))
outputDocument.Save(String.Format("d:\{0} - Page {1}_tempfile.pdf", sNameOnly, i))
Next
End Sub