How can I use document viewer as partial view

Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.

Moderator: Alex

Post Reply
Johnsnow
Posts: 9
Joined: Wed Mar 02, 2022 3:07 pm

How can I use document viewer as partial view

Post by Johnsnow »

Hi,

I am exploring the source codes of VintaSoft ASP.NET Annotation Demo in installation of VintaSoft Imaging NET SDK - function __initMenu in file "[SdkInstallPath]\VintaSoft\Imaging .NET v11.0\Examples\ASP.NET MVC\CSharp\AspNetMvcAnnotationDemo\Scripts\AnnotationDemo.js".

Code: Select all

// register new UI elements
    __registerNewUiElements();

    // create the document viewer settings
    var docViewerSettings = new Vintasoft.Imaging.DocumentViewer.WebDocumentViewerSettingsJS("documentViewerContainer", { annotations: true });

    // initialize main menu of document viewer
    __initMenu(docViewerSettings);

    // initialize side panel of document viewer
    __initSidePanel(docViewerSettings);

    // initialize image viewer panel of document viewer
    __initImageViewerPanel(docViewerSettings);

    // create the document viewer
    _docViewer = new Vintasoft.Imaging.DocumentViewer.WebDocumentViewerJS(docViewerSettings);
in html its

Code: Select all

<div id="documentViewerContainer"></div>
Now, I want to make partial view of this document viewer, to use that either in multiple pages or multiple times on same pages, So can you advise for the same?
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: How can I use document viewer as partial view

Post by Alex »

Hi John,

If you want to use multiple instances of VintaSoft web document viewer, you need to:
  • Create container for each instance of document viewer:

    Code: Select all

    ...
    <div id="documentViewerContainer1"></div>
    ...
    <div id="documentViewerContainer2"></div>
    ...
    
  • Create separate JavaScript instances for each document viewer:

    Code: Select all

    ...
    var docViewerSettings1 = new Vintasoft.Imaging.DocumentViewer.WebDocumentViewerSettingsJS("documentViewerContainer1", { annotations: true });
    ...
    var docViewer1 = new Vintasoft.Imaging.DocumentViewer.WebDocumentViewerJS(docViewerSettings1);
    ...
    var docViewerSettings2 = new Vintasoft.Imaging.DocumentViewer.WebDocumentViewerSettingsJS("documentViewerContainer2", { annotations: true });
    ...
    var docViewer2 = new Vintasoft.Imaging.DocumentViewer.WebDocumentViewerJS(docViewerSettings1);
    ...
    
Best regards, Alexander
Post Reply