1
how to load bytes[] --- > in version DocumentUltimate-v6.6.2.0
Question asked by Pavan Chaudhari - 2/14/2023 at 11:27 PM
Answered
version used :   DocumentUltimate-v6.6.2.0
 
Dear Team ,
in older version we used below code for load documents using bytes[]  
 
DocumentSource = new DocumentSource(
                                new DocumentInfo(Convert.ToString(docpath), filename), databyte )
now we user latest version of DocumentUltimate  , just help me in this version how to load bytes to DocumentViewer  (latest code below)
there was no option for load bytes[]

var model = new DocViewerModel()
 {
     DocViewer = new DocumentViewer()
     {                                  
        SidePaneVisible = false,
        Document = docpath,
        PageFitMode = DocumentViewerPageFitMode.Zoom,
        PageZoomLevel = 100, 
    }, 
 };




Pavan Chaudhari

1 Reply

Reply to Thread
0
Cem Alacayir Replied
Employee Post Marked As Answer
//Setting a MemoryFileProvider instance,
//to connect to a file in a byte array (byte[]) or a MemoryStream:
//Optional parameter dateModified: used for detailed file info, e.g. for generating better cache keys.
documentViewer.Document = new MemoryFileProvider(
    "Document.docx", //file can also be set as a relative path "SomeFolder/Document.docx".
    yourByteArray,
    yourFileDateModified //Provide dateModified to prevent cache key conflicts.
);

Refer to docs:
Also see my reply here:

Reply to Thread