PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Sat Oct 11, 2025 11:20 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules

Also see our new Tailored Support & Services site.



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sat Oct 15, 2011 6:59 pm 
Offline

Joined: Sat Oct 15, 2011 6:55 pm
Posts: 1
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"));
}


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 16, 2011 5:53 am 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 354
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

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
PostPosted: Tue Oct 25, 2011 7:59 pm 
Offline

Joined: Tue Oct 25, 2011 7:51 pm
Posts: 1
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.


Top
 Profile  
Reply with quote  
PostPosted: Wed May 09, 2012 3:39 pm 
Offline

Joined: Wed May 09, 2012 3:21 pm
Posts: 2
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.


Top
 Profile  
Reply with quote  
PostPosted: Wed May 09, 2012 8:47 pm 
Offline

Joined: Wed May 09, 2012 3:21 pm
Posts: 2
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 182 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group