pdf.js as plugin

Hi all,

just wondering if anyone has done this i.e. used pdf.js as plugin. I am aware that there has been some discussions already on getting this to work on item level by adding some codes for the pdf.js (for viewing the pdfs) on show.php. That approach worked for us too. This is our code

<?php if (!$item) $item = get_current_record('item');
$files = $item->Files;
foreach($files as $file)
if ($file->getExtension() =='pdf'){
echo '<iframe width=100% height=800 src="http://xdeevy.nuim.ie/pdf.js/web/viewer.html?file=http://xdeevy.nuim.ie/files/original/'.metadata($file,'filename').'"></iframe>';
}
if($file->getExtension() !='pdf'){
fire_plugin_hook('public_items_show', array('view' => $this, 'item' => $item));
}
?>

But now we are wondering if making it a plugin (just like google doc viewer) would be better.

any thoughts?

Regards
Ranju

A plugin could handle this in a couple different ways.

DocsViewer just adds the viewer at the bottom of the item's page. You could also actually change the way Omeka displays the file, in the way that Html5Media does.

The bigger dilemma for me is where do I start! I was thinking , perhaps I take everything from DocsViewer plugin and modify that to use pdf.js.

Would that be a sensible thing to do?

Anyone done any work on it?

Regards
Ranju