Many browsers can show PDF documents embedded just like pictures within HTML documents using the <embed>
HTML tag. Unfortunately, they are usually unable to detect the preferred (screen) size and aspect ratio of the PDF document and display only a little unreadable thumbnail version of the PDF file.
This plugin adds %EMBEDPDF{...}%
and %EMBEDPDFSIZE{...}%
variables. These variables are helpful for embedding PDF documents in TWiki webs. %EMBEDPDF{...}%
will create an <embed>
HTML tag to show the specified PDF file in a reasonable size (as specified within that PDF file). %EMBEDPDFSIZE{...}%
will expand to the width and height of the file.
TWiki::Func::readFile()
. It may be possible for an attacker to gain access to arbitrary files on your disk. I have taken some simple precautions to prevent this, but I'm not sure whether they are sufficient.
You might want to restrict write access to your Web to prevent intruders from exploiting possible vulnerabilities. I do not think exploits are possible through read-only access. Use at your own risk.
%EMBEDPDF{ <filename> }%
%EMBEDPDFSIZE{ <filename> }%
<filename>
is the file name of an attachment of the current topic.
Assume that test.pdf has a height of 40 points and a width of 100 points. Then:
%EMBEDPDF{ test }%
expands to <embed src="%ATTACHURL%/test" width="100" height="40">
, and
%EMBEDPDFSIZE{ test }%
expands to width="100" height="40"
.pdf
extension is automatically added to the attachment name.
The plugin checks the user agent setting reported by your browser to detect IE. For IE, the width and height will be enlarged since IE displays the PDF viewer controls within the HTML document along with the PDF document itself.
Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%
, i.e. %INTERWIKIPLUGIN_SHORTDESCRIPTION%
data/debug.txt
)
Note: You do not need to have a PDF plugin installed in your browser for this plugin to be useful.install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.
EmbedPDFPlugin.zip
in your twiki installation directory. Content:
File: | Description: |
---|---|
data/TWiki/EmbedPDFPlugin.txt | Plugin topic |
data/TWiki/EmbedPDFPlugin.txt,v | Plugin topic repository |
data/TWiki/EmbedPDFPlugin/pdf.pdf | Sample pdf file |
lib/TWiki/Plugins/EmbedPDFPlugin.pm | Plugin Perl module |
<EMBED />
tag.
%EMBEDPDF{ pdf }%
(click here to display this PDF file by itself) |
%EMBEDPDFSIZE{ pdf }%
are as follows:
(click here to display this PDF file by itself) |
Plugin Author: | TWiki:Main/JohannesMartin |
Plugin Version: | 06 Mar 2003 (V1.001) |
Change History: | |
07 Mar 2003: | added support for IE and link text |
06 Mar 2003: | Initial version |
CPAN Dependencies: | none |
Other Dependencies: | none |
Perl Version: | 5.080 |
Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/EmbedPDFPlugin |
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/EmbedPDFPluginDev |
Related Topics: TWiki:Plugins.EmbedPDFPluginDev, TWikiPreferences, TWikiPlugins
I | Attachment | Size | Date | Who | Comment |
---|---|---|---|---|---|
pdf.pdf | 5.9 K | 06 Mar 2003 - 14:07 | JohannesMartin? | ||
pdf-prerendered.jpg | 3.6 K | 24 Mar 2003 - 15:06 | JohannesMartin? |