Can't see PDF doc received from WCF's ByteArray

2 posts, 0 answers
  1. Davide
    Davide avatar
    5 posts
    Member since:
    Oct 2012

    Posted 27 Oct 2012 Link to this post

    Hello,
    I'm trying to create an application where there is a WCS service that sends a Byte Array to a Silverlight Client. The Byte Array is created directly reading a PDF document through a Binary Reader. The PDF document is dinamically created server side.
    In the Silverlight Client I use a MemoryStream to read the byte array that represents the PDF file.
    Finally I pass the MemoryStream to the PDFDocumentSource that I use as DocumentSource Property in the PDF Viewer.
    The problem is that I see "Loading..", then "Loading..." disappears and the document is not shown in the window.

    Here's my VB code
    Dim MyOutputStream as IO.MemoryStream
    Dim MyFileContent As List(Of Byte)
    .....retrieving data from WCF.....
    MyOutputStream = New MemoryStream(MyFileContent.ToArray)
    Dim MyPDFDocumentSource As New PdfDocumentSource(MyOutputStream)
    AddHandler MyPDFDocumentSource.Loaded, AddressOf MyPdfDocumentSourceLoaded
    RadPdfViewer1.DocumentSource = MyPdfDocumentSource
    ....Then I close the stream in the MyPdfDocumentSourceLoaded routine.....

    I've also tried to read the PDF source file opening it in your online demo and everything works properly.
    Do you have any ideas? Is it an encoding problem? Do you think I have to save the file in the Isolated Storage before open it in the Pdf Viewer Control?
    Best regards.
    David

  2. Davide
    Davide avatar
    5 posts
    Member since:
    Oct 2012

    Posted 27 Oct 2012 Link to this post

    Sorry,
    it works perfectly, I made a mistake in the byte array index.
    Thank you.
    David

  3. DevCraft banner
Back to Top