PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Jul 18, 2024 9:29 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Wed Oct 31, 2012 3:59 pm 
Offline

Joined: Wed Oct 31, 2012 3:32 pm
Posts: 1
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



Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 31, 2012 4:05 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
Hi!

I do not know what makes your undisclosed PDF files so big. I presume it's the fonts that make it so big.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 06, 2015 1:22 pm 
Offline

Joined: Wed Jul 01, 2015 3:09 pm
Posts: 1
Hi,

I have the same Problem. The way I code is the same as ChrisLofffler did.
My large file has about 2000 pages and its size is about 145MB.
When I split the file into 1000 (2 pages per file) oder 2000 (1 page each file) files, the splitted file each is almost so big (135MB, yes it is Mega Bytes) as the source file.

Do you have any idea where the Problem is ?

Regards,
Tru


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 06, 2015 1:37 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
Hi!

I do not know what makes your undisclosed PDF files so big. I presume it's the fonts that make it so big.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 37 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group