Freitag, 31. Januar 2014

Alfresco Share Previewer - set default zoom level to "Fit Width"

The default zoom level of Alfresco Share's Previewer is "Fit Page", which is not perfect for all of us. In our use case we needed default of "Fit Width", but there is no option/overridable setting for that. The only way is to recompile the flash file.

Here is a step-by-step guide to change the setting:


1. check out source of webpreviewer:

I think every developer has some SVN client of his/her choice installed. If not and you don't understand what this means, you should stop now ;)

svn co http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/slingshot/source/as/webpreviewer webpreviewer

2. download/install Adobe Flash Builder Premium 4.7

You can use the evaluation version, there is nor difference in the outcome. Of course you can do that with the free Flex SDK too, but it is more work.

3. open Flash Builder and import a new project:


Select the folder where you checked out the source. Its important to set the SDK to "FLEX 3.6A" to support older flash players.

No changes on the second screen.

Click on browser for the main application file - choose the WebPreviewer.mxml.

After clicking "Finish" you should see the project in your workspace.

4. Change source

Open the file PreviewerClass.as and change method onDocumentSnapPointsChange(...) in line 289:

zoomSlider.value = event.fitToWidth;


5. compile the project with "Export release build"


6. Deploy File

Copy the file WebPreviewer.swf that was just created to your share web application folder.
/tomcat/webapps/share/components/preview/ and override the original file. Perhaps you want to make a backup copy of the original file ;)

7. Test

Open Share in your browser, no server restart needed. Perhaps you have to refresh your browser cache.


You should see the previewer opening in the new default view mode.


Keine Kommentare:

Kommentar veröffentlichen