Skip to content

Commit

Permalink
Item14044: docu fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Apr 28, 2022
1 parent ca6aeee commit 711e9e0
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 18 deletions.
18 changes: 13 additions & 5 deletions data/System/DocumentViewerPlugin.txt
Expand Up @@ -5,7 +5,7 @@

%TOC%

The Document Viewer Plugin allows you to use presentations, spreadsheets, PDFs and other documents in Foswiki without any external dependencies. No tricks, no conversions, no unexpected downtime from external services, and no plugins required it happens to work just fine in all major browsers today.
The Document Viewer Plugin allows you to use presentations, spreadsheets, PDFs and other documents in Foswiki without any external dependencies. No tricks, no conversions, no unexpected downtime from external services, and no plugins required - it happens to work just fine in all major browsers today.

Document Viewer Plugin uses [[http://viewerjs.org/][viewerjs]], which makes use of [[http://mozilla.github.io/pdf.js/][pdf.js]] and [[http://webodf.org/][webodf]] to perform the rendering.

Expand All @@ -18,9 +18,16 @@ Document Viewer Plugin uses [[http://viewerjs.org/][viewerjs]], which makes use

Currently, there aren't any preferences to be configured.

---++ Example
---++ Syntax

=%<nop>DOCUMENTVIEWER{"presentation.pdf"}%=
=%<nop>DOCUMENTVIEWER{"filename.pdf" ... params ...}%=

| *Parameter* | *Description* | *Default* |
| ="&lt;filename>"= | the name of an attached file to be displayed | |
| =topic= | topic where the file is attached to | current topic |
| =format= | one of the ids 'portrait' (width=742, height=1024), 'landscape' (width=1024, height=742) or 'screen' (width=1024, height=768) | |
| =width= | reader width | 724 |
| =height= | reader height | 1024 |

---++ Installation
%$INSTALL_INSTRUCTIONS%
Expand All @@ -30,15 +37,16 @@ Currently, there aren't any preferences to be configured.

---++ Change History

%TABLE%
%TABLE{columnwidths="7em" tablewidth="100%"}%
| 28 Apr 2022 | docu fixes |
| 02 Sep 2016 | make it backwards compatible |
| 27 Sep 2015 | fixed masking warnings |
| 16 Aug 2015 | Initial version |


%META:FORM{name="PackageForm"}%
%META:FIELD{name="Author" title="Author" value="Foswiki:Main.PhilippGortan"}%
%META:FIELD{name="Copyright" title="Copyright" value="2015, Foswiki:Main.PhilippGortan. 2015-2016, Foswiki Contributors. All Rights Reserved"}%
%META:FIELD{name="Copyright" title="Copyright" value="2015, Foswiki:Main.PhilippGortan. 2015-2022, Foswiki Contributors. All Rights Reserved"}%
%META:FIELD{name="Description" title="Description" value="%25$SHORTDESCRIPTION%25"}%
%META:FIELD{name="Home" title="Home" value="https://foswiki.org/Extensions/%$ROOTMODULE%"}%
%META:FIELD{name="License" title="License" value="GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]])"}%
Expand Down
36 changes: 27 additions & 9 deletions lib/Foswiki/Plugins/DocumentViewerPlugin.pm
Expand Up @@ -7,8 +7,8 @@ use warnings;
use Foswiki::Func (); # The plugins API
use Foswiki::Plugins (); # For the API version

our $VERSION = '1.01';
our $RELEASE = '02 Sep 2016';
our $VERSION = '1.02';
our $RELEASE = '22 Apr 2022';
our $SHORTDESCRIPTION =
'Embed presentations, spreadsheets, PDFs and other documents';
our $NO_PREFS_IN_TOPIC = 1;
Expand Down Expand Up @@ -59,16 +59,34 @@ sub _DOCUMENTVIEWER {
my ( $width, $height );

if ( $format eq 'portrait' ) {
$width = 724;
$height = 1024;
if ( $params->{height} ) {
$height = $params->{height};
$width = int( 724 * $height / 1024 );
}
else {
$width = $params->{width} || 724;
$height = int( 1024 * $width / 724 );
}
}
elsif ( $format eq 'landscape' ) {
$width = 1024;
$height = 724;
if ( $params->{height} ) {
$height = $params->{height};
$width = int( 1024 * $height / 724 );
}
else {
$width = $params->{width} || 1024;
$height = int( 724 * $width / 1024 );
}
}
elsif ( $format eq 'screen' ) {
$width = 1024;
$height = 768;
if ( $params->{height} ) {
$height = $params->{height};
$width = int( 1024 * $height / 768 );
}
else {
$width = $params->{width} || 1024;
$height = int( 768 * $width / 1024 );
}
}
else {
$width = $params->{width} || 724;
Expand All @@ -84,7 +102,7 @@ qq(<iframe src="$url" width="$width" height="$height" allowfullscreen webkitallo
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2015-2016 Foswiki Contributors. Foswiki Contributors
Copyright (C) 2015-2022 Foswiki Contributors. Foswiki Contributors
are listed in the AUTHORS file in the root of this distribution.
NOTE: Please extend that file, not this notice.
Expand Down
3 changes: 0 additions & 3 deletions lib/Foswiki/Plugins/DocumentViewerPlugin/Config.spec

This file was deleted.

1 change: 0 additions & 1 deletion lib/Foswiki/Plugins/DocumentViewerPlugin/MANIFEST
Expand Up @@ -2,7 +2,6 @@
data/System/DocumentViewerPlugin.txt 0444 Documentation page
data/System/VarDOCUMENTVIEWER.txt 0444 Tag documentation
lib/Foswiki/Plugins/DocumentViewerPlugin.pm 0444 Perl module
lib/Foswiki/Plugins/DocumentViewerPlugin/Config.spec 0444 Configuration
pub/System/DocumentViewerPlugin/ViewerJS/compatibility.js 0444
pub/System/DocumentViewerPlugin/ViewerJS/example.local.css 0444
pub/System/DocumentViewerPlugin/ViewerJS/images/kogmbh.png 0444
Expand Down

0 comments on commit 711e9e0

Please sign in to comment.