Docs Viewer -don't show pdf anywhere else


I have a number of items to which I am adding a pdf file.

I have installed the docs viewer plugin and I want the pdf to be viewed through this.

At the moment the item page shows the image I want, followed by the pdf I do not want and then the doc viewer plugin displays the pdf. See here for example:

What can I do to stop the pdf displaying outside the doc viewer?

I would also like to disable simple downloading of the pdf from the docviewer.

This post on StackOverflow [] shows how to do it when you have the pdf on your google drive.

However the document isn't on my drive.

Is it possible to restrict downloading?

The problem here is that the Docs Viewer plugin just adds itself to the end of the page. It doesn't change any of the normal display that would otherwise happen, so you get duplicates.

If you want to remove the "normal" display of the file (the thumbnail, or link if there's no thumbnail), then you need to replace the call to files_for_item in your theme. Here you're trying to exclude PDF files, so you could do something like:

set_loop_records('files', $item->Files);
foreach (loop('files') as $file):
    if ($file->getExtension() != 'pdf'):
        echo file_markup($file);

Hi John,

I've been trying to implement this without much luck.

At the rick of sounding foolish where should I be looking to insert this code?In the plugin.php or somewhere in the theme?

I had a chance to come back to this and have had mixed results.

The positive is that I have found the correct place to change the text (/theme/items/show.php).

A further positive is that it works to hide the first appearance of the pdf file as stated by John above.

Unfortunately it has a negative consequence. Inserting the new code means losing the section of the theme that sets the filesize of the item image.

The original code generates this view.

While the altered code has the following result.

I know it should be possible to alter the code to allow both but I'm struggling with it. If anyone has any suggestions they would be gratefully received.

You just need to specify the image size in the call to file_markup:

echo file_markup($file, array('imageSize' => 'fullsize'));

That's great John, thanks again for your help.

If anyone follows along in the future the 'fileSize' mentioned above is actually 'imageSize'.

The changed show.php is available here.

Yeah, oops. I've edited my previous post.