AnsweredAssumed Answered

AlfDocumentPreview / PdfJs Problem

Question asked by christianjanker on Dec 6, 2014
Latest reply on Dec 9, 2014 by christianjanker
Hi guys,

I have tried to build a sample from Dave's blogpost (http://blogs.alfresco.com/wp/developer/2014/11/20/aikau-using-the-alfdocumentpreview/)
Just wanted to create a preview-dialog on a pdf-file, which should open when a button is clicked.



The AlfrescoDocumentPreview.js requires the "alfresco/preview/PdfJs"- module within the "setupPlugins" function. Then the constructor-function of PdfJs gets called. Everything is fine, but unfortunately it seems as if the code where the "Alfresco.WebPreview.prototype.Plugins.PdfJs.prototype" - Object/Mixin/Whatever is added never executes?
Cause later on i fall into the exception that the "onComponentsLoaded"-function is missing when the plugin tries to display.

I definitely missed something. Any ideas on this?




previewAction: function () {
           
           console.log("Within Preview try");
           
           var vs = win.getBox();
           
           var nodeRef = "workspace://SpacesStore/" + this.entry.id;
           
           this.payload = {
                    contentWidth: (vs.w*0.7) + "px",
                    contentHeight: (vs.h-64) + "px",
                    handleOverflow: false,
                    dialogTitle: "PreviewTitle",
                    additionalCssClasses: "no-padding",
                    widgetsContent: [
                       {
                          name: "alfresco/documentlibrary/AlfDocument",
                          nodeRef: nodeRef,
                          config: {
                             widgets: [
                                {
                                   name: "alfresco/preview/AlfDocumentPreview"
                                }
                             ]
                          }
                       }
                    ],
                    widgetsButtons: [
                       {
                          name: "alfresco/buttons/AlfButton",
                          config: {
                             label: "close",
                             publishTopic: "NO_OP"
                          }
                       }
                    ],
                    publishOnShow: [
                       {
                          publishTopic: "ALF_RETRIEVE_SINGLE_DOCUMENT_REQUEST",
                          publishPayload: {
                             nodeRef: nodeRef
                          }
                       }
                    ]
           };

Outcomes