How to cut down on the filesize when merging PDF files?

Q: I am using following code to merge 2 PDF

Total of both PDF files size is 85K
When I was merged the files; size become 241K

Can you please let me know where am I doing wrong?

  Dim url As String = "E:\temp\BMU01_ALBAM_1106_GSM.pdf"
            If url <> "" Then
                'Dim pageNumber As Integer =
                Dim sourcePDFPathWithFileName As String = url

                Dim sourcePDFdoc As PDFDoc = New


                'Dim sourcePDFIterator As PageIterator =
                'Dim sourcePDFpage As Page = sourcePDFIterator.Current
                Dim page_end As PageIterator = sourcePDFdoc.PageEnd()
                Dim itr As PageIterator = sourcePDFdoc.PageBegin()

                While Not itr.Equals(page_end)
                    ' Place the first page
                    Dim sourcePDFpage As Page = itr.Current()
                    Dim mrec As Rect = sourcePDFpage.GetMediaBox

                End While

                bFileToSave = True


            End If

            ' Next

            If bFileToSave = True Then
            End If


The output file size is large because you are importing PDF pages one
by one instead of all at once using ImportPages.

To keep the file size down, you need to use pdfdoc.ImportPages() before
placing the pages using pdfdoc.PagePushBack() etc.

For more information please see the following resources:

- Copying/Merging Pages:
- How do I reduce the file size of a merged PDF document?:
- The last code sample in PDFPage sample project:

Also make sure to specify SDF.Doc.SaveOptions.e_remove_unused or
SDF.Doc.SaveOptions.e_linearized as a hint to Save method. For example:

ew_doc.Save("c:/out.pdf", SDF.Doc.SaveOptions.e_remove_unused);

Thank you very much for your wonderful support which made may life so
easy. I
am now merging more than 100 PDF to a single PDF using 'ImportPage'
The process is much faster and file size of the output file is small

Siva Sharma