PDFsharp & MigraDoc Forum https://forum.pdfsharp.net/ |
|
Concatenate PDF files with PDFSharp return blank pages https://forum.pdfsharp.net/viewtopic.php?f=2&t=1824 |
Page 1 of 1 |
Author: | taevpdfsharp [ Sat Oct 15, 2011 6:59 pm ] |
Post subject: | Concatenate PDF files with PDFSharp return blank pages |
I try to concatenate 2 PDF data from rdlc report. The problem is the result is blank pages. I don't know why, could someone help me please. here is my code: Code: private ActionResult ConcatPdf(byte[] pdfData1, byte[] pdfData2) { MemoryStream ms1 = new MemoryStream(pdfData1); MemoryStream ms2 = new MemoryStream(pdfData2); PdfDocument inputDoc1 = PdfReader.Open(ms1, PdfDocumentOpenMode.Import); PdfDocument inputDoc2 = PdfReader.Open(ms2, PdfDocumentOpenMode.Import); PdfDocument outputDoc = new PdfDocument(); foreach (PdfPage page in inputDoc1.Pages) { outputDoc.AddPage(page); } foreach (PdfPage page in inputDoc2.Pages) { outputDoc.AddPage(page); } MemoryStream outputMs = new MemoryStream(); outputDoc.Save(outputMs); return File(outputMs.ToArray(), "application/pdf"); } In generate report function look like this: Code: public ActionResult TestPDF(int id)
{ // Set report path. LocalReport rep = viewer.LocalReport; rep.ReportPath = Server.MapPath("~/Reports/rptExternalTransferIndividual.rdlc"); rep.DataSources.Clear(); // // Set data and parameter to report. // ... ... return ConcatPdf(viewer.LocalReport.Render("PDF"), viewer.LocalReport.Render("PDF")); } |
Author: | () => true [ Sun Oct 16, 2011 5:53 am ] |
Post subject: | Re: Concatenate PDF files with PDFSharp return blank pages |
Maybe there's something unusual about the PDF files generated from Report Viewer. We need sample files to check it. See also: viewtopic.php?f=3&t=1818&p=5174 viewtopic.php?f=3&t=1730 |
Author: | russellncook [ Tue Oct 25, 2011 7:59 pm ] |
Post subject: | Re: Concatenate PDF files with PDFSharp return blank pages |
I am encountering a similar problem. I'm using SQL Server Reporting Services 2008, saving the generated PDFs to disk and then concatenating. The only difference between the sample concatenation code on the website and the code in teh product is that the original developer added an inputDocument.Close(). We are using version 1.3 of PDfSharp and it works without error when used with Adobe Reader 9.x or earlier. However, I'm running Adobe X (10.1.1.33) on my machine and the concatenated PDF is blank. I've pulled down PDFSharp 1.3.1 and now the inputDocument.Close() call is throwing an error. I commented it out but the resultant concantenated PDF is still blank. I'll upload documents as soon as I can deidentify the health data in them. One thing I noticed when viewing the PDFs in binary format is that RS is generating PDF 1.3 documents while PDFSharp is generating PDF 1.4 documents. And to reiterate, another developer found that the same code works on his machine where he is running Adobe 9.5.4 but he also found a test machine where the code produces blank PDFs and that machine has Adobe X just like mine. Thus, it seems to be an incompatibility that's being exposed by Adobe X. |
Author: | Chris.Stafford [ Wed May 09, 2012 3:39 pm ] |
Post subject: | Re: Concatenate PDF files with PDFSharp return blank pages |
I am also running into this problem. We use Adobe Reader X at work; I am trying to locate a machine with 9.X to test it out and see if I can confirm that the issue stems from the version of Adobe Reader present. |
Author: | Chris.Stafford [ Wed May 09, 2012 8:47 pm ] |
Post subject: | Re: Concatenate PDF files with PDFSharp return blank pages |
After some additional digging, it appears this is caused by SSRS 2008's default compression standards. Using th meethod detailed here: viewtopic.php?f=2&t=674 I am now able to render my SSRS reports, save them, and then produce an aggregate version. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |