Although a late answer, but may be useful.
I am in one situation (C # project using pdfSharp). I have a PowerShell script that ignores files with iref stream when merging (therefore it does not throw an exception).
Function Merge-PDF { Param($path, $filename) $output = New-Object PdfSharp.Pdf.PdfDocument $PdfReader = [PdfSharp.Pdf.IO.PdfReader] $PdfDocumentOpenMode = [PdfSharp.Pdf.IO.PdfDocumentOpenMode] foreach($i in (gci $path *.pdf -Recurse)) { $input = New-Object PdfSharp.Pdf.PdfDocument $input = $PdfReader::Open($i.fullname, $PdfDocumentOpenMode::Import) $input.Pages | %{$output.AddPage($_)} } $output.Save($filename) } Merge-PDF -path c:\reports -filename c:\reports\zzFull_deck.pdf
Will definitely post the C # equivalent of the above function later.
Abdullah leghari
source share