After merging PDF the result is much bigger

Questions, comments and suggestions concerning VintaSoft PDF .NET Plug-in.

Moderator: Alex

Post Reply
ArturZigel
Posts: 1
Joined: Wed Nov 17, 2021 5:09 pm

After merging PDF the result is much bigger

Post by ArturZigel »

After merging PDF the result is much bigger. Why is it so ? I code it with "imagecollection" because sometimes i want to merge PDF with JPG, TIFF or PNG. When i want to merge PDF with PDF the result is much bigger.
Here is my Code:

Code: Select all

	    For Each file In inputFile
                imageCollection.Add(file)
            Next
            
            Dim document As New Vintasoft.Imaging.Pdf.PdfDocument(outputstream, New Vintasoft.Imaging.Pdf.PdfFormat("1.4"))
            For i As Integer = 0 To imageCollection.Count - 1
                 document.Pages.Add(imageCollection(i), Vintasoft.Imaging.Pdf.PdfCompression.Zip)
            Next
            document.SaveChanges()
            imageCollection.Dispose()
            document.Dispose()
I try this code too but nothing work:

Code: Select all

For Each file In inputFile
     imageCollection.Add(file)
Next
Using pdfEncoder As New Vintasoft.Imaging.Codecs.Encoders.PdfEncoder(True)
        pdfEncoder.Settings.Conformance = Vintasoft.Imaging.Pdf.PdfDocumentConformance.PdfA_1b
        imageCollection.SaveSync(outputstream, pdfEncoder)
End Using

thank you, for your help

Artur
Alex
Site Admin
Posts: 2048
Joined: Thu Jul 10, 2008 2:21 pm

Re: After merging PDF the result is much bigger

Post by Alex »

Hello Artur,

By default SDK adds changes to PDF document incrementally, i.e. document stores all changes. If you want to get optimized PDF document, you need to pack PDF document using PdfDocument.Pack method.

Please read how to optimize and compress PDF document here: https://www.vintasoft.com/docs/vsimagin ... ument.html

Best regards, Alexander
Post Reply