FlexPaperViewer.swf is a complete different implementation so you can't just replace it. At a glance it looks like a good and I'm sure it is even though I have now experience of using it. What could be worth pointing out is that Alfresco's webpreview.swf will get support for searching and text-selections eventually, but there is no date set for when that will get done. You can take a look at it at the following url http://issues.alfresco.com/jira/browse/ALF-3984. Please add your comments on why you would like to use FlexPaperViewer instead, what features are you missing in webpreview.swf etc. Preferably on that jira ticket or else as comment right here in the forum.
If you still want to go further the following is probably valuable information:
+ Both of them assume that the conversion is done using pdf2swf, in other words it looks promising making it work. - However I would expect that you need configure the transformation config that is using pdf2swf to turn on the flag for including font information because otherwise the text selection and searches won't work. This is NOT turned on in Alfresco at the moment. If I remember it correctly it is the "-f" flag to you need to add. - Make sure that the variables passed into the previewer are the ones that the FlexPaperViewer.swf expects and not what the webpreviewer.swf expects. Read the FlexPaperViewer.swf documentation to see what it needs. Then…
(function() { var Dom = YAHOO.util.Dom, Event = YAHOO.util.Event, Element = YAHOO.util.Element, $html = Alfresco.util.encodeHTML;
Alfresco.WebPreview.prototype._setupWebPreview = function CustomWebPreview__setupWebPreview() { // Copy code form old method and modify it so it references "FlexPaperViewer.swf" and passes in the correct variables };
})();
4. Make sure your new javascript file is included by overriding the "head" file in {TOMCAT_HOME}/shared/classes/alfresco/web-extension/site-webscripts/org/alfresco/components/preview/web-preview.get.head.ftl
<#include "../component.head.inc"> <!– Web Preview –> <@link rel="stylesheet" type="text/css" href="${page.url.context}/components/preview/web-preview.css" /> <@script type="text/javascript" src="${page.url.context}/components/preview/web-preview.js"></@script> <@script type="text/javascript" src="${page.url.context}/js/flash/extMouseWheel.js"></@script> <!– Include custom code that will stop using Alfresco's previewer 😞 –> <@script type="text/javascript" src="${page.url.context}//components/preview/custom-web-preview.js"></@script>
Well we like to build DMS as a Vault, for embedded preview search option is mandatory else it will not serve purpose. e.g. normal user can not print/copy/download/extract any content from document.