Объединение файлов PDF с помощью PDFSharp возвращает пустые страницы

Я пытаюсь объединить 2 данных PDF из отчета rdlc.

Проблема в том, что результат - пустые страницы.

Я не знаю, почему , не мог бы кто-нибудь мне помочь.

вот мой код:

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");
}

Функция создания отчета выглядит так:

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"));
}
6
задан TaeV 15 October 2011 в 18:17
поделиться