DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
EXT: HTML Alternative for PDF Filelinks¶
Author: | Kasper Skårhøj |
---|---|
Created: | 2002-11-01T00:32:00 |
Changed: | 2006-05-31T13:53:23 |
Author: | Tobias Bruns |
Email: | t.bruns@ogvit.de |
Info 3: | |
Info 4: |
EXT: HTML Alternative for PDF Filelinks¶
Extension Key: ogvit_html_alt_for_pdf
Copyright 2000-2002, Tobias Bruns, <t.bruns@ogvit.de>
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
The content of this document is related to TYPO3
- a GNU/GPL CMS/Framework available from www.typo3.com
Table of Contents¶
EXT: HTML Alternative for PDF Filelinks 1
Introduction 1
What does it do? 1
Screenshots 2
Tutorial 2
Configuration 3
Reference 3
The PDFtoHTML Script 3
Configure the Script 3
Known problems 4
To-Do list 4
Changelog 4
Introduction¶
What does it do?¶
This extension provides automatically generated HTML versions for PDF filelinks by extending CSS styled content(tt_content.20.uploads). PDFtoHTML (http://pdftohtml.sourceforge.net/) is required but it DON'T has to be installed on the websites server. You can specify a server with the constant editor. An example script is shipped with this extension (explained later in this document).
It also replaces the old table based layout for filelinks (still remains in TYPO3 4) by a simple css layout, adds title/alt attributes for the fileicons/preview thumbnails(not only pdf) and overwrites the labels of the filelink layout items in the backend (without fileicon, with fileicon... instead of layout1, layout2...).
Screenshots¶
This screenshot shows the output of some PDF filelinks.
As mentioned above, this extension overwrites the filelink layout item labes (layout1, layout2...). It will look like this (german translation is implemented).
This has nothing to do with the PDF functionality. It's just a usability feature (I hope).
Tutorial¶
Install the extension with the EM (extension manager). The extension key is ogvit_html_alt_for_pdf .
Open the Constant Editor on your root page and specify the url to the PDFtoHTML script (explained later in this document).
Optionally edit the “Filesize Label”, the “Link Title Attribute” and the “Link Text” in the Constant Editor, too. I think the screenshot in the configuration chapter explains it all.
Optionally edit the default css. You can use the following typoscript:
# Clear the default style
plugin.tx_ogvithtmlaltforpdf._CSS_DEFAULT_STYLE >
# These are the default styles. Edit them as you like
plugin.tx_ogvithtmlaltforpdf._CSS_DEFAULT_STYLE (
/************************/
/* Filelinks, generally */
/************************/
UL.csc-uploads { margin: 0; padding: 0; list-style: none inside none; }
UL.csc-uploads LI.tr-even P, LI.tr-odd P { font-weight: normal; font-style: normal; }
UL.csc-uploads LI.tr-even { margin: 0; padding: 0; background-color: #F0EEEF; }
UL.csc-uploads LI.tr-odd { margin: 0; padding: 0; background-color: #FFFFFF; }
UL.csc-uploads DIV.csc-uploads-icon { float: left; margin: 0; padding: 7px 5px 5px 5px; }
UL.csc-uploads DIV.csc-uploads-fileName { float: left; margin: 0; padding: 5px; }
UL.csc-uploads DIV.csc-uploads-fileName P A { font-weight: normal; font-style: normal; }
UL.csc-uploads DIV.csc-uploads-fileName P.csc-uploads-description { font-weight: normal; font-style: normal; }
UL.csc-uploads DIV.csc-uploads-fileName P.csc-uploads-pdfAltLink A { font-weight: normal; font-style: normal; }
UL.csc-uploads DIV.csc-uploads-fileName P.csc-uploads-fileSize { margin: 7px 0 0 0; }
UL.csc-uploads DIV.csc-uploads-clearer { clear: both; font-size: 1px; margin: 0; padding: 0; }
/* Filelinks, specifically */
UL.csc-uploads-1 { }
UL.csc-uploads-2 { }
UL.csc-uploads-3 { }
UL.csc-uploads-3 LI.tr-even DIV.csc-uploads-icon IMG { border: 2px solid #333333; }
UL.csc-uploads-3 LI.tr-odd DIV.csc-uploads-icon IMG { border: 2px solid #333333; }
)
Configuration¶
The following TypoScript Settings can be set by the Constant Editor.
Reference¶
filesizeLabel¶
Property
filesizeLabel
Data type
string
Description
Optional label for the filesize.
Default
Filesize:
linkTitle¶
Property
linkTitle
Data type
string
Description
Here you can edit the title attribute of the HTML version link.
Default
HTML version opens in new window
linkText¶
Property
linkText
Data type
string
Description
This text is used for the HTML version link.
Default
HTML Version
pdfToHtmlURL¶
Property
pdfToHtmlURL
Data type
string
Description
This setting is very important! Here you must specify the URL to the PDFtoHTML script (explained later in this document).
_CSS_DEFAULT_STYLE¶
Property
_CSS_DEFAULT_STYLE
Data type
string
Description
The default css. See the tutorial chapter for detailed information.
Default
The PDFtoHTML Script¶
This Extension uses PDFtoHTML to convert the PDF files to HTML PDFtoHTML is a free command-line programm (like ImageMagick). My example php script ([EXT]/ogvit_html_alt_for_pdf/example/pdf2html_example.php) simply executes this programm with some options. The results (HTML and images) are stored in a subfolder of the webservers (could be a different one) document root and the script finally redirects to the respective HTML file.
I made it this way, because one of our customers requests this converting feature, but don't has the possibility to install PDFtoHTML on his server. With this solution, the converting script can(!) lay on a different server (mine at present :-)).
Thus, you need a webserver with access to PDFtoHTML. I also use CURL, so it has to be installed, too if you use my example script.
Please notice, that this extension has alpha status. It works perfectly on our customers website, but i don't have any experience with other machines yet.
For the future, i've planned to use TYPO3's caching features for the generated files.
Configure the Script¶
If you want to use my script, you have to edit the following variables:
$htmlVersionHost = ' `http://www.your-nice-server.com/ <http://www .your-nice-server.com/>`_ '; The host (or IP) of the server, where this script is hosted. (The ending slash is iportant)
$docRootPath = '/the/absolute/path/to/public_html/'; The absolute path to the document root of the above mentioned server. (The start and ending slashes are important)
$relStorePath = 'tmp/pdftohtml'; The relative path (from document root) to the folder, where the html files should be stored. (No start an ending slashes here)
$pdfToHtmlPath = '/the/absolute/path/to/pdftohtml'; The absolute path to the PDFtoHTML programm. (The start slash is important)
$pdfToHtmlOptions = '-q -dev jpeg -c -noframes'; The options for the PDFtoHTML command (type pdftohtml -help for a list of possible options)
Known problems¶
None yet. Please let me know if you encounter any problems.
To-Do list¶
Better implementation of the PDFtoHTML library. E.g.: Using the TYPO3 caching mechanism for the generated HTML files.