Page 1 of 1

After merging PDF the result is much bigger

Posted: Wed Nov 17, 2021 5:32 pm
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

Re: After merging PDF the result is much bigger

Posted: Thu Nov 18, 2021 9:27 am
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