From c1ad77427a7f547d49b370c5941c80e0d4fe79cd Mon Sep 17 00:00:00 2001 From: Carsten Rose <carsten.rose@math.uzh.ch> Date: Sun, 23 Apr 2017 19:16:03 +0200 Subject: [PATCH] Manual.rst: Cleanup doc for wkhtmltopdf. Remove all references to excel export. Add best practice for 'export area' (IP based restriction). --- extension/Documentation/Manual.rst | 65 +++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/extension/Documentation/Manual.rst b/extension/Documentation/Manual.rst index 617ff798e..f3f5edc8b 100644 --- a/extension/Documentation/Manual.rst +++ b/extension/Documentation/Manual.rst @@ -38,24 +38,25 @@ To normalize UTF8 input, the *php5-intl* resp. *php7.0-intl* package is needed b * normalizer::normalize() +For the `download`_ function, the program `pdftk` is necessary to concatenate PDF files. + Preparation for Ubuntu 14.04:: - sudo apt-get install php5-mysqlnd php5-intl + sudo apt-get install php5-mysqlnd php5-intl pdftk sudo php5enmod mysqlnd sudo service apache2 restart Preparation steps for Ubuntu 16.04:: - sudo apt install php7.0-intl + sudo apt install php7.0-intl pdftk + +wkhtmltopdf +^^^^^^^^^^^ -wkhtmltopdf: print page / convert HTML to PDF -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Different browser prints the same page in different variations. To prevent this, QFQ implements a small PHP wrapper `print.php` -which uses http://wkhtmltopdf.org/ (webkit based) to convert HTML to PDF. The converter is also during `download`_ to -convert HTML to PDF. The converter is not included in QFQ and has to be manually installed. +`wkhtmltopdf` http://wkhtmltopdf.org/ will be used by QFQ to offer 'website print' and 'HTML to PDF' conversion. +The converter is not included in QFQ and has to be manually installed. -Hint: * The Ubuntu package `wkhtmltopdf` needs a running Xserver - this does not work on a headless webserver. Best is to install the QT version from the named website above. * FE_GROUP protected pages/tt-content are not accessible via `wkhtmltopdf`. @@ -66,6 +67,17 @@ In `config-qfq-ini`_ specify the: * installed `wkhtmltopdf` binary, * the site base URL. +HTML to PDF conversion +'''''''''''''''''''''' + +`wkhtmltopdf` converts a website (local or remote) to a (multi)-page PDF file. It's mainly used in `download`_. + +Print +''''' + +Different browser prints the same page in different variations. To prevent this, QFQ implements a small PHP wrapper +`print.php` with `wkhtmltopdf` in behind. + Provide a `print this page`-link (replace {current pageId}):: <a href="typo3conf/ext/qfq/qfq/api/print.php?id={current pageId}">Print this page</a> @@ -76,7 +88,7 @@ Typoscript code to implement a print link on every page:: 10 = TEXT 10 { - wrap = <a href="typo3conf/ext/qfq/qfq/api/print.php?id=|&type=2"><span class="glyphicon glyphicon-print" aria-hidden="true"></span> Printview</a> + wrap = <a href="typo3conf/ext/qfq/qfq/api/print.php?id=...|&type=2"><span class="glyphicon glyphicon-print" aria-hidden="true"></span> Printview</a> data = page:uid } @@ -1235,10 +1247,7 @@ Such variant might be called via SIP. The following shows the same *Form* in the 10.sql = SELECT CONCAT('from&form=person&r=', p.id) as _Pagee, CONCAT('from&form=person&formModeGlobal=readonly&r=', p.id) as _Pagee FROM Person AS p - - - - +.. FormElements ------------ @@ -3321,7 +3330,7 @@ Column: _link +---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+ | | |SIP |s[:0|1] |s, s:0, s:1 |If 's' or 's:1' a SIP entry is generated with all non Typo 3 Parameters. The URL contains only parameter 's' and Typo 3 parameter | +---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+ -| | |Mode |M:file|pdf|excel|zip |M:file, M:pdf, M:excel |Mode. Used to specify type of download. One or more element sources needs to be configured. See `download`_. | +| | |Mode |M:file|pdf|zip |M:file, M:pdf, M:zip |Mode. Used to specify type of download. One or more element sources needs to be configured. See `download`_. | +---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+ | | |File |f:<filename> |f:fileadmin/file.pdf |Element source for download mode file|pdf|zip. See `download`_. | +---+---+--------------+-----------------------------------+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------+ @@ -3453,7 +3462,6 @@ Download offers: * download a single file (any type), * concatenate several files (uploaded) and/or web pages (=HTML to PDF) into one PDF output file, -* create an `excel` export (based on a Typo3 page which creates XML output), * create a ZIP archive, filled with several files ('uploaded' or 'HTML to PDF'-converted). The downloads are SIP protected. Only the current user can use the link to download files. @@ -3461,11 +3469,11 @@ The downloads are SIP protected. Only the current user can use the link to downl By using the `_link` columnname: * the option `d:...` initiate creating the download link and optional specifies an export filename, -* the optional `M:...` (Mode) specifies the export type (file, pdf, excel, zip), +* the optional `M:...` (Mode) specifies the export type (file, pdf, zip), * setting `s:1` is mandatory for the download function, * the alttext `a:...` specifies a message in the dowload popup. -By using `_pdf`, `_Pdf`, `_file`, `_File`, `_excel`, `_Excel`, `_zip`, `_Zip` as columnname the options `d`, `m` and `s` +By using `_pdf`, `_Pdf`, `_file`, `_File`, `_zip`, `_Zip` as columnname the options `d`, `m` and `s` will be set by automatically. All files will be read by PHP - therefore the directory might be protected against direct web access. This way is the @@ -3495,14 +3503,13 @@ Parameter and (element) sources * *mode*: `m:<mode>` - * *mode* = <file | pdf | excel | zip> - This parameter is optional and can be skipped in most situations. Mandatory - for 'excel', 'zip'. + * *mode* = <file | pdf | zip> - This parameter is optional and can be skipped in most situations. Mandatory + for 'zip'. * If `m:file`, the mimetype is derived dynamically from the specified file. In this mode, only one element source is allowed per download link (no concatenation). * In case of multiple element sources, only `pdf` or `zip` is supported. - * `m:excel` is not implemented now. * If `m:zip` is used together with `U:...` oder `u:..`, those HTML pages will be converted to PDF. Those files get generic filenames inside the archive. * If not specified, the **default** depends on the number of specified element sources (=file or web page). @@ -3552,6 +3559,24 @@ Example: :: .. +Export area +''''''''''' + +To offer protected pages, e.g. referenced in download links, the regular FE_GROUPs can't be used, cause the download does +not have the current user privileges (it's a separate process, started as the webserver user). + +Create a separated export tree in Typo3 Backend, which is IP access restricted. Only localhost or the FE_GROUP 'admin' +is allowed to access: :: + + [IP = {$tmp.restrictedIPRange} ][usergroup = admin] + page.10 < styles.content.get + [else] + page.10 = TEXT + page.10.value = Please access from localhost or log in as 'admin' user. + [global] + +.. + Columns: _page[X] ^^^^^^^^^^^^^^^^^ -- GitLab