We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

loading from array bytes

how do i upload the pdf directly from array bytes?


 Dim jsonResult As Dictionary(Of String, String)
            Dim helper As New PdfViewerHelper()

            Dim docBytes = System.IO.File.ReadAllBytes(HttpContext.Current.Server.MapPath("~/TmpF/uno.pdf"))
            Dim docBase64 As String = Convert.ToBase64String(docBytes)
            Dim byteArray() As Byte = Convert.FromBase64String(docBase64)
            Dim stream As New MemoryStream(byteArray)
            helper.Load(stream)
            Return JsonConvert.SerializeObject(helper.ProcessPdf(jsonResult))

1 Reply

AA Akshaya Arivoli Syncfusion Team September 25, 2019 10:07 AM UTC

Hi Antonio ,  

Thank you for contacting Syncfusion Support. 

We can load the PDF document as byteArray in the PDF Viewer from the server side using the Load() API in the WebAPI controller. Please find the code snippet from the below, 

Private viewerHelper As New PdfViewerHelper() 
Dim docBytes = System.IO.File.ReadAllBytes(HttpContext.Current.Server.MapPath("~/Data/PdfViewer/HTTP Succinctly.pdf")) 
viewerHelper.Load(docBytes) 

We have created the sample for the same and shared in the following location, 


Please find the below KB link for reference, 


Please try this revert us with more details if you have any concerns on this. 

Regards, 
Akshaya 


Loader.
Live Chat Icon For mobile
Up arrow icon