AnsweredAssumed Answered

Customizing Aikau PdfJs Preview Widget

Question asked by on Feb 23, 2017
Latest reply on Mar 1, 2017 by



I'm pretty new to Share development so please bear with me.


What I'd like to do is the following :


1) Change the behaviour of the Aikau PdfJs viewer, so that it is maximized by default.

2) Show the PDF outline/thumbnail sidebar by default.


So, far I'm failing to make much progress on 1) - i've got the following config, and I suspect the <targetPackageRoot> is incorrect, but i've tried 'preview' and 'document-details' packages. The preview one seems the most logical.


What else do I need ? Is the below sufficient to push an updated config to the widget ? 


What about the ID's ?

I couldnt figure out what the ID should be for AlfDocumentPreview, so I tried finding by name. At the moment, I dont think the .js is even being run, so its a non-starter.

Can you push a config to the widget without an ID ?


On the off-chance that i'm on the right track, is using 'widgetsForPluginsOverrides' the correct mechanism to use? 


Finally, can I use the same mechanism to perform requirement 2) - It doesnt look like there is a flag for the sidebar, although the vanilla mozilla pdfjs appears to have a "sidebarViewOnLoad"... I can see there is a onSideBarToggle() method, but how can I cause this to fire ?


For what its worth, I have been through the excellent Aikau tutorials by Dave Draper, but I cant help feeling i'm missing something fundamental when it comes to lightly modifying a widget through a surf extension module.


Thanks for any help / pointers.







               <id>Custom Document Preview Widget</id>
               <description>Instantiate a Document Preview Widget</description>


var docPreview = widgetUtils.findObject(model.jsonModel, "name",
this.alfLog("log", "In override viewer Widget", config);

if (docPreview != null) {
this.alfLog("log", "Found Preview Widget ", config);
          name : "alfresco/preview/AlfDocumentPreview",
          config : {
               heightMode : 600,

               widgetsForPluginsOverrides : [ {
                    id : "PdfJs",                    
                    name: "alfresco/preview/PdfJs/PdfJs",
                    replace: true,
                    config: {
                         maximized : "true" }
               } ]