Combining Multiple PDFs Using PDFSharp


Answer :

I have come to believe that it might be the input PDFs that are corrupt or unreadable to PDFSharp. There are several examples of SSRS PDFs not being readable to PDF-libraries or even Adobe's Reader. For example here:

http://www.sqldev.org/sql-server-reporting-services/export-pdf-in-ssrs-2008-vs-ssrs-2005--pdf-is-different-wont-work-with-itextsharp-possibly-other-13968.shtml

... and here:

https://stackoverflow.com/questions/2393175/ssrs-2008-pdf-files-cannot-be-opened

... AND most importantly on the PDFSharp forum:

http://forum.pdfsharp.net/viewtopic.php?f=2&t=674

I don't know if this is the bug you're encountering - the message is strange - but it seems likely to have something to do with that, when you take in to consideration that your code sample works flawlessly with any PDF I tried (I don't have any SQL Server Reports to try out, though)


I don't sure about my answer. Please read your self.

http://www.go4coding.com/post/2011/05/26/Merging-PDF-files-into-single-PDF-in-CSharp-using-PDFSharp.aspx

private static void MergeMultiplePDFIntoSinglePDF(string outputFilePath, string[] pdfFiles) {     Console.WriteLine("Merging started.....");     PdfDocument outputPDFDocument = new PdfDocument();      foreach (string pdfFile in pdfFiles)     {         PdfDocument inputPDFDocument = PdfReader.Open(pdfFile, PdfDocumentOpenMode.Import);         outputPDFDocument.Version = inputPDFDocument.Version;          foreach (PdfPage page in inputPDFDocument.Pages)         {             outputPDFDocument.AddPage(page);         }     }     outputPDFDocument.Save(outputFilePath);      Console.WriteLine("Merging Completed"); } 

Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?