package ONO::Lib::PDF::Object;
################################################################################
# COPYRIGHT / LICENSE #
################################################################################
#
# This file is part of the ONO Software Project.
#
# Copyright (C) 2000-2025 Jos KIRPS [ www.kirps.com | jos_AT_kirps_DOT_com ]
# and The Joopita Project [ www.joopita.org | contact_AT_joopita_DOT_com ]
#
# This file, as well as other parts of the ONO Software Project or related
# elements, are FREE SOFTWARE available under the ARTISTIC LICENSE 2.0.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# For the full license, see /ono/osr/license/LICENSE.txt, or write to
# jos_AT_kirps_DOT_com or contact_AT_joopita_DOT_com.
#
################################################################################
# END OF COPYRIGHT / LICENSE, HERE COMES THE CODE ... #
################################################################################
use strict;
use ONO::IO;
sub viewer {
my (
$self,
$file,
$width,
$height,
$switches,
$community,
) = @_;
#: ONO PDF Viewer, powered by ViewerJS, allows to render PDF files live in the client browser.
#:
#: -p display Protected file (will require $community in most cases)
if (!$width) {
$width = 600;
}
if (!$height) {
$height = 540;
}
my $unit = "px";
if ($switches =~ /p/) {
if ($community) {
$file = ONO::IO->base."/cgi-bin/file.pl?community=$community&file=$file";
} else {
$file = ONO::IO->base."/cgi-bin/file.pl?file=$file";
}
}
return qq~<iframe src="/ono/osr/javascript/viewerjs/#$file" width="$width" height="$height" border="0"
style="width:${width}$unit;height:${height}$unit;border:0px" allowfullscreen webkitallowfullscreen></iframe>
~;
}
###############################################################################
# end of script
###############################################################################
1;
__END__