locked
Combine two byte arrays from rdlc to create a pdf RRS feed

  • Question

  • User-1600699211 posted

    I have two byte arrays from rdlc reports.

    I need to create a pdf combining both the byte arrays.

    My code is

    Warning[] warnings;
                    string[] streamIds;
                    string mimeType = string.Empty;
                    string encoding = string.Empty;
                    string extension = string.Empty;

                    bytes = rptViewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);

                    bytes1 = RunReport(21316228, "82", 7);

                    byte[] combined = new byte[bytes.Length + bytes1.Length];
                    bytes.CopyTo(combined, 0); 
                    Array.Copy(bytes1, 0, combined, bytes.Length, bytes1.Length);

                    FileStream stream = new FileStream(savePath, FileMode.Create, FileAccess.ReadWrite);
                    using (stream)
                    {
                        stream.Write(combined, 0, combined.Length);
                    }

     

    The RunReport function returns bytes1 which is generated from another rdlc report. I can see the size of combined byte is fine but its just printing the 2nd byte but not appending 1 and 2.

    I tried various other codes using Buffer.BlockCopy etc.. similar to this but all of them yield the same result.

    Some one please help me out!

    Tuesday, September 28, 2010 11:42 AM

All replies

  • User313501468 posted

    Were you able to resolve this?  I am trying to combine two reports in the same manner, but I get the same results as you: only the second byte() is rendered. 

    Tuesday, January 18, 2011 6:33 PM
  • User-37275327 posted

    Create 2 pdfs. use itextsharp to merge the report.


    Tuesday, February 1, 2011 5:49 AM
  • User-1355692323 posted

    I have tried the same thing with itextsharp.

    Dim pdfReader1 As New PdfReader(renderedBytes)
    Dim pdfReader2 As New PdfReader(renderedBytes2)

    Using finaloutput As MemoryStream = New MemoryStream()
    Dim copy As PdfCopyFields = New PdfCopyFields(finaloutput)
    copy.AddDocument(pdfReader1)
    copy.AddDocument(pdfReader2)
    copy.SetFullCompression()
    copy.Close()
    Return File(finaloutput.ToArray(), "PDF", "test.pdf")
    End Using

    Tuesday, March 3, 2015 9:19 AM